author | ca |
Sun, 01 Feb 2004 12:49:59 +0100 | |
changeset 2614 | 86086fc6a99c |
parent 2611 | 9814b5547d63 |
child 2617 | 1611c130d5e9 |
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 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
41 |
Object subclass:#ScrollActivity |
2145 | 42 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
43 |
classVariableNames:'' |
|
44 |
poolDictionaries:'' |
|
45 |
privateIn:MenuPanel |
|
2016 | 46 |
! |
47 |
||
388 | 48 |
!MenuPanel class methodsFor:'documentation'! |
49 |
||
2005 | 50 |
copyright |
51 |
" |
|
52 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
2145 | 53 |
All Rights Reserved |
2005 | 54 |
|
55 |
This software is furnished under a license and may be used |
|
56 |
only in accordance with the terms of that license and with the |
|
57 |
inclusion of the above copyright notice. This software may not |
|
58 |
be provided or otherwise made available to, or used by, any |
|
59 |
other person. No title to or ownership of the software is |
|
60 |
hereby transferred. |
|
61 |
" |
|
62 |
||
388 | 63 |
! |
64 |
||
65 |
documentation |
|
66 |
" |
|
67 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
68 |
||
2170 | 69 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
388 | 70 |
(and hopefully be ST-80 compatible ...) |
71 |
||
502 | 72 |
To create a menu, there exists a MenuEditor which will generate |
73 |
a menu specification. |
|
74 |
||
75 |
||
2061 | 76 |
Notice: |
77 |
This is going to replace the obsolete MenuView. |
|
78 |
||
388 | 79 |
[author:] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
80 |
Claus Atzkern |
388 | 81 |
|
82 |
[see also:] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
83 |
Menu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
84 |
MenuItem |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
85 |
MenuEditor |
2170 | 86 |
|
87 |
cg: this code is so ugly - needs a complete rewrite... |
|
88 |
||
388 | 89 |
" |
90 |
! |
|
91 |
||
92 |
examples |
|
93 |
||
94 |
" |
|
95 |
start as PullDownMenu |
|
2219 | 96 |
[exBegin] |
388 | 97 |
|top subView mview desc s1 s2 s3 img lbs labels| |
98 |
||
99 |
top := StandardSystemView new. |
|
100 |
||
436 | 101 |
mview := MenuPanel in:top. |
388 | 102 |
|
502 | 103 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 104 |
mview level:2. |
105 |
mview verticalLayout:false. |
|
106 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 107 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 108 |
mview labels:lbs. |
109 |
mview shortcutKeyAt:2 put:#Cut. |
|
110 |
mview accessCharacterPositionAt:1 put:1. |
|
111 |
mview accessCharacterPositionAt:2 put:2. |
|
112 |
||
113 |
mview enabledAt:5 put:false. |
|
114 |
mview groupSizes:#( 2 2 ). |
|
436 | 115 |
s1 := MenuPanel labels:labels. |
388 | 116 |
s1 accessCharacterPositionAt:1 put:1. |
117 |
s1 accessCharacterPositionAt:2 put:2. |
|
118 |
s1 groupSizes:#( 2 2 ). |
|
436 | 119 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
120 |
s3 := MenuPanel labels:lbs. |
|
388 | 121 |
|
122 |
s1 subMenuAt:2 put:s2. |
|
436 | 123 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 124 |
s2 subMenuAt:3 put:s3. |
436 | 125 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 126 |
s3 shortcutKeyAt:3 put:$q. |
127 |
||
128 |
mview subMenuAt:1 put:s1. |
|
436 | 129 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 130 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
131 |
s1 shortcutKeyAt:1 put:#Copy. |
|
132 |
s1 shortcutKeyAt:3 put:#Paste. |
|
133 |
||
436 | 134 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 135 |
top extent:(mview preferredExtent). |
388 | 136 |
top open. |
2219 | 137 |
[exEnd] |
138 |
||
139 |
[exBegin] |
|
1767 | 140 |
|top menu view item| |
141 |
||
142 |
top := StandardSystemView extent:240@100. |
|
143 |
menu := MenuPanel in:top. |
|
144 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
145 |
menu verticalLayout:false. |
|
146 |
||
147 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
148 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
149 |
||
150 |
view := ClockView new. |
|
151 |
view preferredExtent:100@100. |
|
152 |
item := menu itemAt:3. |
|
153 |
item submenu:view. |
|
154 |
||
155 |
view := SimpleView new. |
|
156 |
view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new). |
|
157 |
view preferredExtent:(400@50). |
|
158 |
item := menu itemAt:2. |
|
159 |
item submenu:view. |
|
160 |
||
161 |
menu origin:0@0 corner:1.0@30. |
|
162 |
top open. |
|
2219 | 163 |
[exEnd] |
388 | 164 |
|
165 |
||
166 |
start as PopUpMenu |
|
2219 | 167 |
[exBegin] |
388 | 168 |
|subView mview desc s1 s2 s3 img lbs labels| |
169 |
||
436 | 170 |
mview := MenuPanel new. |
502 | 171 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 172 |
mview level:2. |
173 |
||
174 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 175 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 176 |
mview labels:lbs. |
177 |
||
436 | 178 |
s1 := MenuPanel labels:labels. |
179 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
180 |
s3 := MenuPanel labels:lbs. |
|
388 | 181 |
s1 subMenuAt:2 put:s2. |
436 | 182 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 183 |
s2 subMenuAt:3 put:s3. |
436 | 184 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 185 |
s3 shortcutKeyAt:3 put:$q. |
186 |
||
187 |
mview subMenuAt:1 put:s1. |
|
436 | 188 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 189 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
190 |
s1 shortcutKeyAt:1 put:#Copy. |
|
191 |
s1 shortcutKeyAt:3 put:#Paste. |
|
192 |
||
436 | 193 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 194 |
mview startUp |
2219 | 195 |
[exEnd] |
388 | 196 |
|
197 |
||
198 |
start from menu spec |
|
2219 | 199 |
[exBegin] |
388 | 200 |
|menu| |
201 |
||
436 | 202 |
menu := MenuPanel menu: |
2219 | 203 |
#(#Menu #( #(#MenuItem |
204 |
#label: 'File' |
|
205 |
#submenu: |
|
206 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
207 |
(#MenuItem |
|
208 |
#label: 'edit' |
|
209 |
#submenu: |
|
210 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
211 |
#(#MenuItem #label: 'close' #value:#close) |
|
212 |
) |
|
213 |
nil |
|
214 |
nil |
|
215 |
) |
|
216 |
) |
|
217 |
#(#MenuItem #label: 'help' #value:#help ) |
|
218 |
) |
|
219 |
nil |
|
220 |
nil |
|
221 |
) |
|
222 |
) |
|
223 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
224 |
#(#MenuItem #label: 'Bar' |
|
225 |
#submenu: |
|
226 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
227 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
228 |
) |
|
229 |
nil |
|
230 |
nil |
|
231 |
) |
|
232 |
) |
|
233 |
) |
|
234 |
#( 2 ) |
|
235 |
nil |
|
236 |
) decodeAsLiteralArray. |
|
388 | 237 |
|
238 |
menu verticalLayout:false. |
|
239 |
Transcript showCR:(menu startUp). |
|
2219 | 240 |
[exEnd] |
388 | 241 |
|
242 |
" |
|
243 |
||
244 |
! ! |
|
245 |
||
246 |
!MenuPanel class methodsFor:'instance creation'! |
|
247 |
||
248 |
fromSpec:aSpec |
|
249 |
^ self fromSpec:aSpec receiver:nil |
|
250 |
! |
|
251 |
||
252 |
fromSpec:aSpec receiver:aReceiver |
|
253 |
|menu| |
|
254 |
||
255 |
aSpec notNil ifTrue:[ |
|
2219 | 256 |
menu := Menu new. |
257 |
menu receiver:aReceiver. |
|
258 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 259 |
]. |
260 |
^ self menu:menu receiver:aReceiver |
|
261 |
! |
|
262 |
||
263 |
labels:labels |
|
264 |
^ self labels:labels nameKeys:nil receiver:nil |
|
265 |
! |
|
266 |
||
267 |
labels:labels nameKeys:nameKeys |
|
268 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
269 |
! |
|
270 |
||
271 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
272 |
|mview| |
|
273 |
||
274 |
mview := self menu:nil receiver:aReceiver. |
|
275 |
mview labels:labels. |
|
276 |
mview nameKeys:nameKeys. |
|
277 |
^ mview |
|
278 |
||
279 |
! |
|
280 |
||
502 | 281 |
labels:labels receiver:aReceiver |
282 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
283 |
! |
|
284 |
||
388 | 285 |
menu:aMenu |
286 |
^ self menu:aMenu receiver:nil |
|
287 |
! |
|
288 |
||
289 |
menu:aMenu receiver:aReceiver |
|
290 |
|mview| |
|
291 |
||
292 |
mview := self new. |
|
1955 | 293 |
|
294 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
2219 | 295 |
"/ no receiver specified in the menu; thus set the receiver immediately |
296 |
mview receiver:aReceiver |
|
1955 | 297 |
]. |
298 |
||
388 | 299 |
mview menu:aMenu. |
300 |
||
1955 | 301 |
|
388 | 302 |
"/ a menu itself may contain a receiver |
303 |
"/ thus we do not overwrite the receiver |
|
304 |
||
305 |
aReceiver notNil ifTrue:[ |
|
2219 | 306 |
mview receiver:aReceiver |
388 | 307 |
]. |
308 |
^ mview |
|
309 |
! ! |
|
310 |
||
311 |
!MenuPanel class methodsFor:'class initialization'! |
|
312 |
||
313 |
initialize |
|
657 | 314 |
" |
315 |
self initialize |
|
316 |
" |
|
317 |
||
388 | 318 |
InitialSelectionQuerySignal isNil ifTrue:[ |
2253 | 319 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 320 |
]. |
321 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
322 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 323 |
! |
324 |
||
325 |
preSnapshot |
|
326 |
"remove all resources |
|
327 |
" |
|
328 |
Images := nil. |
|
329 |
LigthenedImages := nil. |
|
330 |
||
616 | 331 |
! ! |
332 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
333 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
334 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
335 |
delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
336 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
337 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
338 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
339 |
"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
|
340 |
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
|
341 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
342 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
343 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
344 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
345 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
346 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
347 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
348 |
<resource: #image> |
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 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
351 |
constantNamed:#'MenuPanel class delayedMenuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
352 |
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
|
353 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
354 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
355 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
356 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
357 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
358 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
359 |
"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
|
360 |
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
|
361 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
362 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
363 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
364 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
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 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
367 |
<resource: #image> |
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 |
^Icon |
2219 | 370 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
371 |
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
|
372 |
! |
1798
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 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
375 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
376 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
377 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
378 |
"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
|
379 |
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
|
380 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
381 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
382 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
383 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
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 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
386 |
<resource: #image> |
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 |
^Icon |
2219 | 389 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
390 |
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
|
391 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
392 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
393 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
394 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
395 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
396 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
397 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
398 |
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
|
399 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
400 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
401 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
402 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
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 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
405 |
<resource: #image> |
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 |
^Icon |
2219 | 408 |
constantNamed:#'MenuPanel iconIndicationOff' |
409 |
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
|
410 |
! |
1726
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 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
413 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
414 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
415 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
416 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
417 |
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
|
418 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
419 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
420 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
421 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
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 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
424 |
<resource: #image> |
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 |
^Icon |
2219 | 427 |
constantNamed:#'MenuPanel iconIndicationOn' |
428 |
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
|
429 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
430 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
431 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
432 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
433 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
434 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
435 |
"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
|
436 |
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
|
437 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
438 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
439 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
440 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
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 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
443 |
<resource: #image> |
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 |
^Icon |
2219 | 446 |
constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
447 |
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
|
448 |
! |
1798
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 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
451 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
452 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
453 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
454 |
"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
|
455 |
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
|
456 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
457 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
458 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
459 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 460 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
461 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
462 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
463 |
<resource: #image> |
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 |
^Icon |
2337 | 466 |
constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
467 |
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
|
468 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
469 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
470 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
471 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
472 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
473 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
474 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
475 |
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
|
476 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
477 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
478 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
479 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
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 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
482 |
<resource: #image> |
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 |
^Icon |
2219 | 485 |
constantNamed:#'MenuPanel iconRadioGroupOff' |
486 |
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
|
487 |
! |
1726
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 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
490 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
491 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
492 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
493 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
494 |
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
|
495 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
496 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
497 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
498 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
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 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
501 |
<resource: #image> |
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 |
^Icon |
2219 | 504 |
constantNamed:#'MenuPanel iconRadioGroupOn' |
505 |
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
|
506 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
507 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
508 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
509 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
510 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
511 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
512 |
"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
|
513 |
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
|
514 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
515 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
516 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
517 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
518 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
519 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
520 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
521 |
<resource: #image> |
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 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
524 |
constantNamed:#'MenuPanel::Item class menuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
525 |
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
|
526 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
527 |
|
616 | 528 |
!MenuPanel class methodsFor:'defaults'! |
450 | 529 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
530 |
defaultBackgroundColor |
2609 | 531 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 532 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
533 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
534 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
535 |
defaultLevel |
2372 | 536 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
537 |
" |
|
538 |
self defaultLevel |
|
539 |
" |
|
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 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
542 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
543 |
"returns an additional offset between the label and the |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
544 |
delayedMenu indication (i.e. the down-arrow icon) |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
545 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
546 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
547 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
548 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
549 |
menuIndicatorOffset |
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 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
551 |
delayedMenu indication (i.e. the down-arrow icon) |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
552 |
" |
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 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
556 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
557 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
558 |
ex: |
2219 | 559 |
&File mnemonic := Cmdf |
560 |
F&ile mnemonic := Cmdi |
|
561 |
..... |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
562 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
563 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
564 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
565 |
|
450 | 566 |
updateStyleCache |
657 | 567 |
|
2219 | 568 |
<resource: #style ( |
569 |
#'popup.borderWidth' #'popup.level' |
|
570 |
#'selection.disabledForegroundColor' |
|
571 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
572 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
573 |
#'menu.buttonItemVerticalSpace' |
|
574 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
|
575 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
576 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
577 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
578 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
579 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
580 |
#'menu.selectionFollowsMouse' |
|
581 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
582 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
583 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
584 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
585 |
)> |
|
586 |
||
587 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
588 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel| |
|
2607 | 589 |
|
2611 | 590 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
591 |
which returns the default cashed DefaultBackgroundColor |
|
592 |
" |
|
593 |
DefaultBackgroundColor := nil. |
|
594 |
||
2219 | 595 |
MenuView updateStyleCache. |
596 |
SelectionInListView updateStyleCache. |
|
1699 | 597 |
|
2372 | 598 |
styleSheet := StyleSheet. |
599 |
style := styleSheet name. |
|
600 |
||
2607 | 601 |
DefaultFont := MenuView defaultFont. |
2609 | 602 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' default:Color black. |
603 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
|
2219 | 604 |
|
605 |
var := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
|
2374 | 606 |
var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
2219 | 607 |
styleSheet at:#'menuPanel.buttonInsetX' put:(var abs). |
608 |
||
609 |
var := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
2374 | 610 |
var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
2219 | 611 |
styleSheet at:#'menuPanel.buttonInsetY' put:(var abs). |
612 |
||
613 |
var := styleSheet at:#'menu.itemHorizontalSpace'. |
|
2374 | 614 |
var isNil ifTrue:[ var := styleSheet at:#'menu.itemSpace' default:0 ]. |
2219 | 615 |
styleSheet at:#'menuPanel.itemSpace' put:var. |
616 |
||
617 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 618 |
var isNil ifTrue:[ |
2219 | 619 |
style == #motif ifTrue:[ var := backgroundColor ] |
620 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
621 |
]. |
|
622 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
623 |
||
624 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 625 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 626 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
627 |
||
628 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 629 |
var isNil ifTrue:[ |
2219 | 630 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
2374 | 631 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 632 |
]. |
633 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
634 |
||
635 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 636 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 637 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
638 |
||
639 |
||
640 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 641 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 642 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
643 |
||
644 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 645 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 646 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
647 |
||
648 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
649 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
650 |
||
651 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
652 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
653 |
||
654 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 655 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
2219 | 656 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
657 |
]. |
|
658 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
659 |
||
660 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 661 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 662 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
663 |
||
664 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 665 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 666 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
667 |
||
668 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 669 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 670 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
671 |
||
672 |
Item updateStyleCache. |
|
2607 | 673 |
|
674 |
" |
|
675 |
self updateStyleCache |
|
676 |
" |
|
388 | 677 |
! ! |
678 |
||
794 | 679 |
!MenuPanel class methodsFor:'image registration'! |
680 |
||
681 |
image:anImage onDevice:aDevice |
|
682 |
" |
|
683 |
Images := nil |
|
684 |
" |
|
2269 | 685 |
|deviceImages| |
794 | 686 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
687 |
anImage device == aDevice ifTrue:[ |
2269 | 688 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
689 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
690 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
691 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 692 |
|
1097 | 693 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2269 | 694 |
Images at:aDevice put:(deviceImages := Dictionary new) |
695 |
]. |
|
696 |
||
697 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
698 |
image := anImage copy onDevice:aDevice. |
|
699 |
image clearMaskedPixels. |
|
700 |
deviceImages at:anImage put:image. |
|
701 |
image |
|
702 |
]. |
|
794 | 703 |
! |
704 |
||
705 |
lightenedImage:anImage onDevice:aDevice |
|
706 |
" |
|
707 |
LigthenedImages := nil |
|
708 |
" |
|
2374 | 709 |
|deviceImages image colorMap| |
794 | 710 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
711 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 712 |
|
1097 | 713 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2374 | 714 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 715 |
]. |
716 |
||
717 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
2374 | 718 |
^ image |
719 |
]. |
|
720 |
||
721 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
722 |
||
723 |
colorMap notNil ifTrue:[ |
|
724 |
image := anImage copy lightened onDevice:aDevice. |
|
725 |
image clearMaskedPixels. |
|
794 | 726 |
] ifFalse:[ |
2374 | 727 |
image := self image:anImage onDevice:aDevice |
794 | 728 |
]. |
1097 | 729 |
deviceImages at:anImage put:image. |
794 | 730 |
^ image |
731 |
! ! |
|
732 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
733 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
734 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
735 |
subMenu:aSubMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
736 |
"create a submenu; can be redifined in derived classes |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
737 |
" |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
738 |
^ (self new) menu:aSubMenu. |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
739 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
740 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
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 |
|
1808 | 743 |
!MenuPanel methodsFor:'accepting'! |
389 | 744 |
|
745 |
accept |
|
746 |
"accept current selected item |
|
747 |
" |
|
1670 | 748 |
^ self acceptItem:(self selection) inMenu:self |
389 | 749 |
! |
750 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
751 |
accept:anItem |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
752 |
"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
|
753 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
754 |
|value item tgState itemIdx recv panel masterGroup winGrp acceptAction| |
1630 | 755 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
756 |
self superMenu notNil ifTrue:[ |
2253 | 757 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
758 |
]. |
2199 | 759 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
760 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
761 |
self selection:nil. |
420 | 762 |
|
763 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
2253 | 764 |
tgState := anItem toggleIndication. |
765 |
panel := anItem menuPanel. |
|
766 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
767 |
item := anItem. |
|
768 |
recv := panel receiver. |
|
389 | 769 |
]. |
1699 | 770 |
self doUngrab:true. |
389 | 771 |
|
510 | 772 |
self isPopUpView ifFalse:[ |
2253 | 773 |
self do:[:el| el updateIndicators]. |
774 |
self windowGroup processExposeEvents. |
|
524 | 775 |
] ifTrue:[ |
2253 | 776 |
self unmap. |
777 |
(winGrp := self windowGroup) notNil ifTrue:[ |
|
778 |
"/ give expose event a chance to arrive |
|
779 |
[shown and:[realized]] whileTrue:[ |
|
780 |
winGrp processExposeEventsFor:self |
|
781 |
]. |
|
782 |
masterGroup := winGrp previousGroup. |
|
783 |
]. |
|
784 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
785 |
"/ self destroy. |
|
786 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
524 | 787 |
]. |
1710 | 788 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
789 |
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
|
790 |
|
1710 | 791 |
(item notNil |
792 |
and:[item showBusyCursorWhilePerforming |
|
793 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
794 |
ifTrue:[ |
|
2253 | 795 |
winGrp withWaitCursorDo:acceptAction |
2132 | 796 |
] ifFalse:[acceptAction value]. |
524 | 797 |
|
798 |
self isPopUpView ifTrue:[ |
|
2253 | 799 |
self menuAdornmentAt:#item put:item. |
524 | 800 |
]. |
1699 | 801 |
^ item. |
524 | 802 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
803 |
"Modified: / 15.11.2001 / 17:05:40 / cg" |
524 | 804 |
! |
805 |
||
806 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
807 |
"accept an item |
|
808 |
" |
|
2253 | 809 |
|value argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
810 |
app master fallBack| |
524 | 811 |
|
812 |
anItem isNil ifTrue:[ |
|
2253 | 813 |
self menuAdornmentAt:#hasPerformed put:true. |
814 |
^ nil |
|
815 |
]. |
|
816 |
||
817 |
isValueModel := aReceiver isValueModel. |
|
818 |
||
819 |
self menuAdornmentAt:#hasPerformed put:isValueModel. |
|
524 | 820 |
|
821 |
(value := anItem value) isNil ifTrue:[ |
|
2253 | 822 |
^ anIndex |
524 | 823 |
]. |
824 |
||
825 |
(argument := anItem argument) isNil ifTrue:[ |
|
2253 | 826 |
argument := aState ? anItem |
389 | 827 |
]. |
524 | 828 |
|
829 |
value isSymbol ifFalse:[ |
|
2253 | 830 |
"/ a valueHolder or block |
831 |
(value respondsTo:#valueWithArguments:) ifFalse:[ |
|
832 |
^ value |
|
833 |
]. |
|
834 |
||
835 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
|
836 |
||
837 |
numArgs == 0 ifTrue:[ |
|
838 |
args := nil |
|
839 |
] ifFalse:[ |
|
840 |
numArgs == 1 ifTrue:[ |
|
841 |
args := Array with:argument |
|
842 |
] ifFalse:[ |
|
843 |
args := Array with:argument with:self |
|
844 |
] |
|
845 |
]. |
|
846 |
||
847 |
value valueWithArguments:args. |
|
848 |
||
849 |
self menuAdornmentAt:#hasPerformed put:true. |
|
850 |
^ anIndex |
|
524 | 851 |
]. |
852 |
||
2331 | 853 |
anItem sendToOriginator ifTrue:[ |
2473 | 854 |
rec := self originator. |
855 |
rec isNil ifTrue:[ |
|
856 |
self error:'no originating widget (no target for message)'. |
|
857 |
]. |
|
2331 | 858 |
] ifFalse:[ |
859 |
rec := aReceiver |
|
860 |
]. |
|
861 |
||
862 |
rec isNil ifTrue:[ |
|
2253 | 863 |
^ value |
864 |
]. |
|
865 |
||
866 |
isValueModel ifTrue:[ |
|
2331 | 867 |
rec value:value |
465 | 868 |
] ifFalse:[ |
2253 | 869 |
arg2 := self. |
870 |
||
871 |
"/ support for ST80 style applications |
|
872 |
"/ (expecting the message to go to the application |
|
873 |
"/ if not understood by the view) |
|
874 |
"/ These expect the controller to be passed as argument. |
|
875 |
"/ sigh. |
|
876 |
||
2331 | 877 |
(rec isView |
878 |
and:[(rec respondsTo:value) not |
|
879 |
and:[(app := rec application) ~~ rec |
|
2253 | 880 |
and:[app notNil]]]) ifTrue:[ |
2331 | 881 |
arg2 := rec controller. "/ the Views controller |
2253 | 882 |
rec := app. |
883 |
]. |
|
884 |
||
885 |
(numArgs := value numArgs) == 0 ifTrue:[ |
|
886 |
args := nil |
|
887 |
] ifFalse:[ |
|
888 |
numArgs == 1 ifTrue:[ |
|
889 |
args := Array with:argument |
|
890 |
] ifFalse:[ |
|
891 |
args := Array with:argument with:arg2 |
|
892 |
] |
|
893 |
]. |
|
894 |
||
895 |
fallBack := |
|
896 |
[ |
|
897 |
"/ mhmh - the receiver did not respond to that message; |
|
898 |
"/ if there is a master-application, try that one |
|
899 |
"/ (recursive) |
|
900 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
901 |
master notNil ifTrue:[ |
|
902 |
rec := master. |
|
903 |
rec perform:value withArguments:args ifNotUnderstood:fallBack |
|
904 |
] ifFalse:[ |
|
905 |
self |
|
906 |
error:'unimplemented (or error in) menu message: ' , value |
|
907 |
mayProceed:true |
|
908 |
]. |
|
909 |
]. |
|
910 |
||
911 |
rec perform:value withArguments:args ifNotUnderstood:fallBack. |
|
420 | 912 |
]. |
524 | 913 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
914 |
^ value |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
915 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
916 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 917 |
! |
918 |
||
1670 | 919 |
acceptItem:anItem inMenu:aMenu |
2199 | 920 |
|tgState topMenu| |
921 |
||
922 |
topMenu := self topMenu. |
|
923 |
topMenu openDelayed:nil. |
|
1670 | 924 |
|
1841 | 925 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
2219 | 926 |
topMenu accept:anItem |
1670 | 927 |
] ifFalse:[ |
2219 | 928 |
anItem canAccept ifTrue:[ |
929 |
tgState := anItem toggleIndication. |
|
930 |
||
931 |
self accept:anItem |
|
932 |
index:(aMenu selectionIndex) |
|
933 |
toggle:tgState |
|
934 |
receiver:(aMenu receiver). |
|
935 |
||
936 |
aMenu do:[:el| el updateIndicators]. |
|
937 |
] |
|
1670 | 938 |
] |
939 |
! |
|
940 |
||
389 | 941 |
lastItemAccepted |
942 |
"returns last item selected or nil |
|
943 |
" |
|
390 | 944 |
^ self topMenu menuAdornmentAt:#item |
389 | 945 |
! |
946 |
||
947 |
lastValueAccepted |
|
948 |
"returns last value accepted or nil |
|
949 |
" |
|
2253 | 950 |
^ self lastItemAccepted value |
389 | 951 |
! ! |
952 |
||
388 | 953 |
!MenuPanel methodsFor:'accessing'! |
954 |
||
955 |
accessCharacterPositionAt:stringOrNumber |
|
390 | 956 |
"get the access character position for a textLabel |
388 | 957 |
" |
2059 | 958 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 959 |
! |
960 |
||
961 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
390 | 962 |
"get the access character position for a textLabel |
388 | 963 |
" |
964 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
|
965 |
! |
|
966 |
||
967 |
accessCharacterPositions |
|
968 |
"returns a collection of accessCharacterPosition's or nil |
|
969 |
" |
|
970 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
|
971 |
||
972 |
! |
|
973 |
||
974 |
accessCharacterPositions:something |
|
975 |
"define accessCharacterPosition's for each item |
|
976 |
" |
|
977 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
|
978 |
! |
|
979 |
||
980 |
args |
|
981 |
"returns a collection of argument's or nil |
|
982 |
" |
|
983 |
^ self collect:[:anItem| anItem argument ] |
|
984 |
! |
|
985 |
||
986 |
args:something |
|
987 |
"define arguments for each item |
|
988 |
" |
|
989 |
self onEachPerform:#argument: withArgList:something |
|
990 |
! |
|
991 |
||
992 |
argsAt:stringOrNumber |
|
993 |
"gets the argument of an item or nil |
|
994 |
" |
|
2059 | 995 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 996 |
! |
997 |
||
998 |
argsAt:stringOrNumber put:anArgument |
|
999 |
"sets the argument of an item |
|
1000 |
" |
|
1001 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
|
1002 |
! |
|
1003 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1004 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1005 |
"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
|
1006 |
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
|
1007 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1008 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1009 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1010 |
"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
|
1011 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1012 |
|
388 | 1013 |
groupSizes |
1014 |
"gets collection of group sizes |
|
1015 |
" |
|
1016 |
^ groupSizes |
|
1017 |
! |
|
1018 |
||
1019 |
groupSizes:aGroupSizes |
|
1020 |
"sets collection of group sizes |
|
1021 |
" |
|
1022 |
aGroupSizes = groupSizes ifFalse:[ |
|
2145 | 1023 |
groupSizes := aGroupSizes copy. |
1024 |
self mustRearrange. |
|
388 | 1025 |
]. |
1026 |
! |
|
1027 |
||
1028 |
labelAt:stringOrNumber |
|
1029 |
"gets the label of an item or nil |
|
1030 |
" |
|
1031 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
|
1032 |
! |
|
1033 |
||
1034 |
labelAt:stringOrNumber put:aLabel |
|
1035 |
"sets the label of an item |
|
1036 |
" |
|
1037 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
|
1038 |
! |
|
1039 |
||
1040 |
labels |
|
1041 |
"returns a collection of labels's or nil |
|
1042 |
" |
|
1043 |
^ self collect:[:anItem| anItem label ] |
|
1044 |
||
1045 |
! |
|
1046 |
||
1047 |
labels:labels |
|
1048 |
"define labels for each item |
|
1049 |
" |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1050 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1051 |
|
388 | 1052 |
self disabledRedrawDo:[ |
2219 | 1053 |
self removeAll. |
1054 |
size := labels size. |
|
1055 |
||
1056 |
size > 0 ifTrue:[ |
|
1057 |
items := OrderedCollection new:size. |
|
1058 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1059 |
] |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1060 |
]. |
388 | 1061 |
! |
1062 |
||
1999 | 1063 |
menuPerformer:anObject |
1064 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1065 |
from all submenus no specific receiver is defined ). |
|
1066 |
" |
|
1067 |
^ self receiver:anObject |
|
1068 |
! |
|
1069 |
||
388 | 1070 |
nameKeyAt:stringOrNumber |
1071 |
"gets the nameKey of an item or nil |
|
1072 |
" |
|
1073 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
1074 |
! |
|
1075 |
||
1076 |
nameKeyAt:stringOrNumber put:aNameKey |
|
1077 |
"sets the nameKey of an item |
|
1078 |
" |
|
1079 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
|
1080 |
! |
|
1081 |
||
1082 |
nameKeys |
|
1083 |
"returns a collection of nameKeys's or nil |
|
1084 |
" |
|
1085 |
^ self collect:[:anItem| anItem nameKey ] |
|
1086 |
! |
|
1087 |
||
1088 |
nameKeys:something |
|
1089 |
"define nameKeys for each item |
|
1090 |
" |
|
1091 |
self onEachPerform:#nameKey: withArgList:something |
|
1092 |
! |
|
1093 |
||
1094 |
numberOfItems |
|
1095 |
"gets number of items |
|
1096 |
" |
|
1097 |
^ items size |
|
1098 |
! |
|
1099 |
||
2331 | 1100 |
originator |
1101 |
originator notNil ifTrue:[^ originator]. |
|
1102 |
superMenu notNil ifTrue:[ |
|
1103 |
^ superMenu originator |
|
1104 |
]. |
|
1105 |
^ nil |
|
1106 |
! |
|
1107 |
||
388 | 1108 |
receiver |
1109 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1110 |
from all submenus no specific receiver is defined ). |
|
1111 |
" |
|
389 | 1112 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
2145 | 1113 |
^ superMenu receiver |
388 | 1114 |
]. |
389 | 1115 |
^ receiver |
388 | 1116 |
! |
1117 |
||
1118 |
receiver:anObject |
|
1119 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1120 |
from all submenus no specific receiver is defined ). |
|
1121 |
" |
|
389 | 1122 |
receiver := anObject |
388 | 1123 |
! |
1124 |
||
1125 |
shortcutKeyAt:stringOrNumber |
|
1126 |
"gets the shortCutKey of an item or nil |
|
1127 |
" |
|
1128 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
1129 |
! |
|
1130 |
||
1131 |
shortcutKeyAt:stringOrNumber put:aKey |
|
1132 |
"sets the shortCutKey of an item |
|
1133 |
" |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1134 |
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
|
1135 |
! |
388 | 1136 |
|
1137 |
shortcutKeys |
|
1138 |
"returns a collection of shortcutKey's or nil |
|
1139 |
" |
|
1140 |
^ self collect:[:anItem| anItem shortcutKey ] |
|
1141 |
||
1142 |
! |
|
1143 |
||
1144 |
shortcutKeys:something |
|
1145 |
"define shortcutKey's for each item |
|
1146 |
" |
|
1147 |
self onEachPerform:#shortcutKey: withArgList:something |
|
1148 |
! |
|
1149 |
||
1150 |
valueAt:stringOrNumber |
|
1151 |
"gets value of an item; a block, valueHolder, ... |
|
1152 |
" |
|
1153 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
1154 |
||
1155 |
! |
|
1156 |
||
1157 |
valueAt:stringOrNumber put:someThing |
|
1158 |
"sets value of an item; a block, valueHolder, ... |
|
1159 |
" |
|
1160 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
|
1161 |
||
1162 |
||
1163 |
! |
|
1164 |
||
1165 |
values:something |
|
1166 |
"define values for each item |
|
1167 |
" |
|
1168 |
self onEachPerform:#value: withArgList:something |
|
1169 |
! ! |
|
1170 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1171 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1172 |
|
1173 |
disableAll |
|
498 | 1174 |
"disable all items; not the menu in case of enabled |
388 | 1175 |
" |
498 | 1176 |
self do:[:anItem| anItem enabled:false] |
388 | 1177 |
! |
1178 |
||
1179 |
disableAll:collectionOfIndicesOrNames |
|
1180 |
"disable an collection of items |
|
1181 |
" |
|
1182 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
|
1183 |
||
1184 |
! |
|
1185 |
||
1186 |
enableAll |
|
498 | 1187 |
"enable all items; not the menu in case of disabled |
388 | 1188 |
" |
498 | 1189 |
self do:[:anItem| anItem enabled:true] |
388 | 1190 |
! |
1191 |
||
1192 |
enableAll:collectionOfIndicesOrNames |
|
1193 |
"enable an collection of items |
|
1194 |
" |
|
1195 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
|
1196 |
||
1197 |
! |
|
1198 |
||
1199 |
enabled |
|
1200 |
"returns enabled state |
|
1201 |
" |
|
498 | 1202 |
^ enabled |
388 | 1203 |
! |
1204 |
||
1205 |
enabled:aState |
|
1206 |
"change enabled state of menu |
|
1207 |
" |
|
545 | 1208 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1209 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1210 |
state := aState ? true. |
388 | 1211 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1212 |
enabled ~~ state ifTrue:[ |
2219 | 1213 |
enabled := state. |
1214 |
self invalidate. |
|
498 | 1215 |
]. |
388 | 1216 |
! |
1217 |
||
1218 |
enabledAt:stringOrNumber |
|
1219 |
"gets the enabled state of an item or false |
|
1220 |
" |
|
1221 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
|
1222 |
! |
|
1223 |
||
1224 |
enabledAt:stringOrNumber put:aState |
|
1225 |
"sets the enabled state of an item |
|
1226 |
" |
|
1227 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
|
1228 |
! |
|
1229 |
||
1230 |
isEnabled:stringOrNumber |
|
1231 |
"gets the enabled state of an item or false |
|
1232 |
" |
|
1233 |
^ self enabledAt:stringOrNumber |
|
1234 |
! ! |
|
1235 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1236 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1237 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1238 |
enableChannel:aValueHolder |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1239 |
"set my enableChannel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1240 |
" |
498 | 1241 |
enableChannel notNil ifTrue:[ |
2145 | 1242 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1243 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1244 |
|
498 | 1245 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
2145 | 1246 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1247 |
]. |
498 | 1248 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1249 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1250 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1251 |
menuHolder:aValueHolder |
498 | 1252 |
"set my menuHolder |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1253 |
" |
498 | 1254 |
menuHolder notNil ifTrue:[ |
2145 | 1255 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1256 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1257 |
|
498 | 1258 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
2145 | 1259 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1260 |
]. |
498 | 1261 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1262 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1263 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1264 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1265 |
|
616 | 1266 |
activeBackgroundColor |
1267 |
"get the background drawing color used to highlight selection |
|
1268 |
" |
|
2219 | 1269 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1270 |
! |
1271 |
||
1272 |
activeForegroundColor |
|
1273 |
"get the foreground color used to highlight selections |
|
1274 |
" |
|
2219 | 1275 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1276 |
! |
1277 |
||
390 | 1278 |
backgroundColor |
1279 |
"return the background color |
|
1280 |
" |
|
502 | 1281 |
^ super viewBackground |
390 | 1282 |
! |
1283 |
||
1284 |
backgroundColor:aColor |
|
1285 |
"set the background drawing color. You should not use this method; |
|
1286 |
instead leave the value as defined in the styleSheet. |
|
1287 |
" |
|
616 | 1288 |
super viewBackground ~~ aColor ifTrue:[ |
2145 | 1289 |
super viewBackground:aColor. |
1290 |
shown ifTrue:[ |
|
1291 |
self invalidate "/ RepairNow:true |
|
1292 |
] |
|
616 | 1293 |
] |
1294 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1295 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1296 |
! |
1297 |
||
727 | 1298 |
buttonActiveBackgroundColor |
1299 |
"get the background drawing color used to highlight button selection |
|
1300 |
" |
|
2219 | 1301 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
1302 |
default:(self viewBackground) |
|
727 | 1303 |
! |
1304 |
||
730 | 1305 |
buttonEdgeStyle |
1306 |
"get the button edge style |
|
1307 |
" |
|
2219 | 1308 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1309 |
! |
1310 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1311 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1312 |
"get the background drawing color used to highlight entered button items |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1313 |
" |
2219 | 1314 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1315 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1316 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1317 |
buttonEnteredLevel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1318 |
"get the 3D-level used to highlight entered button items |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1319 |
" |
2219 | 1320 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1321 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1322 |
|
730 | 1323 |
buttonHalfLightColor |
1324 |
"get the background drawing color used to half light button frame |
|
1325 |
" |
|
2219 | 1326 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1327 |
! |
1328 |
||
1329 |
buttonHalfShadowColor |
|
1330 |
"get the background drawing color used to half shadow button frame |
|
1331 |
" |
|
2219 | 1332 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1333 |
! |
1334 |
||
1335 |
buttonLightColor |
|
1336 |
"get the background drawing color used to light button frame |
|
1337 |
" |
|
2219 | 1338 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1339 |
! |
1340 |
||
1341 |
buttonPassiveBackgroundColor |
|
1342 |
"get the background drawing color used for button |
|
1343 |
" |
|
2219 | 1344 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1345 |
! |
1346 |
||
1347 |
buttonShadowColor |
|
1348 |
"get the background drawing color used to shadow button frame |
|
1349 |
" |
|
2219 | 1350 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1351 |
! |
1352 |
||
1353 |
disabledEtchedForegroundColor |
|
1354 |
"return the color used for etching disabled items. |
|
1355 |
If nil, no 3D effect is drawn. |
|
1356 |
" |
|
2219 | 1357 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1358 |
! |
1359 |
||
390 | 1360 |
disabledForegroundColor |
1361 |
"return the foreground color used by disabled items |
|
1362 |
" |
|
2219 | 1363 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1364 |
! |
1365 |
||
2170 | 1366 |
enteredBackgroundColor |
1367 |
"return the background color for entered items |
|
1368 |
" |
|
2219 | 1369 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
1370 |
default:(self backgroundColor) |
|
2170 | 1371 |
! |
1372 |
||
1373 |
enteredForegroundColor |
|
1374 |
"return the foreground color for entered items |
|
1375 |
" |
|
2219 | 1376 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1377 |
! |
1378 |
||
390 | 1379 |
font:aFont |
1380 |
"set the font |
|
1381 |
" |
|
2614 | 1382 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1383 |
||
1384 |
super font:aFont. |
|
1385 |
self do:[:anItem| anItem fontChanged ]. |
|
1386 |
||
1387 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
1388 |
self extent:(self preferredExtent) |
|
1389 |
]. |
|
1390 |
self mustRearrange. |
|
390 | 1391 |
! |
1392 |
||
1393 |
foregroundColor |
|
1394 |
"return the passive foreground color |
|
1395 |
" |
|
2059 | 1396 |
^ fgColor |
390 | 1397 |
! |
1398 |
||
1399 |
foregroundColor:aColor |
|
1400 |
"set the foregroundColor drawing color. You should not use this method; |
|
1401 |
instead leave the value as defined in the styleSheet. |
|
1402 |
" |
|
2219 | 1403 |
aColor ~= fgColor ifTrue:[ |
1478 | 1404 |
fgColor := aColor onDevice:device. |
2219 | 1405 |
shown ifTrue:[ self invalidate ] |
1406 |
]. |
|
580 | 1407 |
! |
1408 |
||
1699 | 1409 |
maxAbsoluteButtonLevel |
1410 |
"returns the maximum absolute button level; used to compute the preferred |
|
1411 |
extent of a button |
|
1412 |
" |
|
2219 | 1413 |
^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' |
390 | 1414 |
! |
1415 |
||
730 | 1416 |
selectionFrameBrightColor |
1417 |
"get the selection frame bright color |
|
1418 |
" |
|
2219 | 1419 |
^ Color white |
730 | 1420 |
! |
1421 |
||
1422 |
selectionFrameDarkColor |
|
1423 |
"get the selection frame dark color |
|
1424 |
" |
|
2219 | 1425 |
^ Color black |
730 | 1426 |
! |
1427 |
||
1727 | 1428 |
setFont:aFont |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1429 |
"set the font if the argument is nonNil; |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1430 |
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
|
1431 |
|
1727 | 1432 |
|currentFont| |
1433 |
||
1434 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1435 |
currentFont := font. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1436 |
super font:aFont. |
1727 | 1437 |
]. |
1438 |
^ currentFont |
|
390 | 1439 |
! ! |
1440 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1441 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1442 |
|
1443 |
height |
|
1444 |
"default height |
|
1445 |
" |
|
1446 |
(explicitExtent ~~ true) ifTrue:[ |
|
2219 | 1447 |
^ self preferredExtent y |
388 | 1448 |
]. |
1449 |
^ super height |
|
1450 |
! |
|
1451 |
||
2016 | 1452 |
maxExtent |
1453 |
"CLAUS: returns the maximum extent |
|
1454 |
" |
|
1455 |
|x y| |
|
1456 |
||
1457 |
device isNil ifTrue:[ |
|
2219 | 1458 |
superMenu notNil ifTrue:[ |
1459 |
^ superMenu maxExtent |
|
1460 |
]. |
|
2016 | 1461 |
]. |
1462 |
y := device usableHeight - 2. |
|
1463 |
x := device usableWidth - 2. |
|
1464 |
^ x@y |
|
1465 |
! |
|
1466 |
||
388 | 1467 |
preferredExtent |
1468 |
"compute and returns my preferred extent |
|
2016 | 1469 |
" |
2253 | 1470 |
|maxExtent usedExtent| |
2024 | 1471 |
|
2016 | 1472 |
preferredExtent notNil ifTrue:[ |
2253 | 1473 |
^ preferredExtent |
2016 | 1474 |
]. |
2024 | 1475 |
maxExtent := self maxExtent. |
1476 |
usedExtent := self preferredExtentOfItems. |
|
1477 |
||
1478 |
superView isNil ifTrue:[ |
|
2253 | 1479 |
"/ is standalone |
2374 | 1480 |
preferredWidth notNil ifTrue:[ |
2253 | 1481 |
usedExtent x < preferredWidth ifTrue:[ |
1482 |
usedExtent := preferredWidth @ usedExtent y. |
|
1483 |
] |
|
1484 |
] |
|
2024 | 1485 |
]. |
1486 |
||
1487 |
^ usedExtent min:maxExtent |
|
1488 |
||
1489 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1490 |
! |
1491 |
||
1492 |
preferredExtentOfItems |
|
1493 |
"compute and returns my preferred extent including all items |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1494 |
!!!!!! changes have influence on method #rearrangeItems !!!!!! |
388 | 1495 |
" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1496 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1497 |
x "{ Class:SmallInteger }" |
1498 |
y "{ Class:SmallInteger }" |
|
1499 |
size "{ Class:SmallInteger }" |
|
2145 | 1500 |
buttonInsetX "{ Class:SmallInteger }" |
1501 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 1502 |
labelInsetX "{ Class:SmallInteger }" |
1503 |
labelInsetY "{ Class:SmallInteger }" |
|
1504 |
itemSpace "{ Class:SmallInteger }" |
|
1505 |
itemMargin "{ Class:SmallInteger }" |
|
1506 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1507 |
| |
388 | 1508 |
|
1699 | 1509 |
(size := items size) == 0 ifTrue:[ |
2219 | 1510 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1511 |
^ 32 @ 32 |
2219 | 1512 |
]. |
1513 |
buttonInsetX := 2 * self buttonInsetX. |
|
1514 |
buttonInsetY := 2 * self buttonInsetY. |
|
1699 | 1515 |
|
1516 |
self isPopUpView ifFalse:[ |
|
2219 | 1517 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1518 |
] ifTrue:[ |
2145 | 1519 |
labelInsetX := labelInsetY := 0. |
1699 | 1520 |
]. |
1521 |
||
1522 |
x := 0. |
|
1523 |
y := 0. |
|
2219 | 1524 |
groupDividerSize := self groupDividerSize. |
388 | 1525 |
|
1526 |
self verticalLayout ifFalse:[ |
|
2219 | 1527 |
itemSpace := self itemSpace. |
1528 |
||
1699 | 1529 |
items keysAndValuesDo:[:key :el| |eX eY| |
1530 |
extent := el preferredExtent. |
|
1531 |
||
1532 |
"/ check for visibility (extent x ~~ 0) |
|
1533 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1534 |
eY := extent y. |
|
1535 |
||
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1536 |
el isButton ifTrue:[ |
2145 | 1537 |
eX := eX + buttonInsetX. |
1538 |
eY := eY + buttonInsetY. |
|
1699 | 1539 |
] ifFalse:[ |
2145 | 1540 |
eX := eX + labelInsetX. |
1541 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1542 |
]. |
1699 | 1543 |
key ~~ size ifTrue:[ |
1544 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1545 |
x := x + groupDividerSize |
|
1546 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1547 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1548 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1549 |
] |
1699 | 1550 |
] |
1551 |
]. |
|
1552 |
x := eX + x. |
|
1553 |
y := eY max:y. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1554 |
] |
1699 | 1555 |
] |
388 | 1556 |
] ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1557 |
hasMenu := false. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1558 |
shCtKey := 0. |
1699 | 1559 |
showAcc := MenuView showAcceleratorKeys == true. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1560 |
y := x. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1561 |
x := 0. |
2219 | 1562 |
itemMargin := 2 * self itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1563 |
|
1699 | 1564 |
items keysAndValuesDo:[:key :el| |eX eY| |
1565 |
extent := el preferredExtent. |
|
1566 |
||
1567 |
"/ check for visibility (extent x ~~ 0) |
|
1568 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1569 |
eY := extent y. |
|
1570 |
||
1571 |
el isButton ifTrue:[ |
|
2145 | 1572 |
eX := eX + buttonInsetX. |
1573 |
eY := eY + buttonInsetY. |
|
1699 | 1574 |
] ifFalse:[ |
2145 | 1575 |
eX := eX + labelInsetX. |
1576 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1577 |
]. |
1699 | 1578 |
hasMenu ifFalse:[ |
1579 |
hasMenu := el hasSubmenu |
|
1580 |
]. |
|
1581 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1582 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1583 |
]. |
|
1584 |
key ~~ size ifTrue:[ |
|
1585 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1586 |
y := y + groupDividerSize |
|
1587 |
] |
|
1588 |
]. |
|
1589 |
y := eY + y. |
|
1590 |
x := eX max:x. |
|
1591 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1592 |
]. |
2219 | 1593 |
x := x + itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1594 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1595 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1596 |
shortKeyInset := x + Item labelRightOffset. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1597 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1598 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1599 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
2219 | 1600 |
x := x + self shortcutKeyOffset. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1601 |
] |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1602 |
]. |
1699 | 1603 |
"/ to have a small inset |
1604 |
y := y + 1. |
|
1605 |
"/ x := x + 1. |
|
1606 |
]. |
|
1607 |
x := x + margin + margin. |
|
1608 |
y := y + margin + margin. |
|
1609 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1610 |
^ x @ y |
388 | 1611 |
! |
1612 |
||
2253 | 1613 |
preferredWidth:aWidthOrNil |
1614 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1615 |
If nil (default), the width is computed from the contained items. |
|
1616 |
If not nil, the width is the maximum from the contained items and the required width. |
|
1617 |
" |
|
1618 |
preferredWidth := aWidthOrNil. |
|
2024 | 1619 |
! |
1620 |
||
388 | 1621 |
shortKeyInset |
1622 |
"left inset of shortcutKey |
|
1623 |
" |
|
1624 |
^ shortKeyInset |
|
616 | 1625 |
! |
1626 |
||
1627 |
subMenuIndicationWidth |
|
2219 | 1628 |
^ self rightArrow width |
388 | 1629 |
! ! |
1630 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1631 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1632 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1633 |
iconIndicationDisabledOff |
2219 | 1634 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1635 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1636 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1637 |
iconIndicationDisabledOn |
2219 | 1638 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1639 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1640 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1641 |
iconIndicationOff |
2219 | 1642 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1643 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1644 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1645 |
iconIndicationOn |
2219 | 1646 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1647 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1648 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1649 |
iconRadioGroupDisabledOff |
2219 | 1650 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
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 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1653 |
iconRadioGroupDisabledOn |
2219 | 1654 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1655 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1656 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1657 |
iconRadioGroupOff |
2219 | 1658 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
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 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1661 |
iconRadioGroupOn |
2219 | 1662 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1663 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1664 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1665 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1666 |
|
1667 |
itemAt:stringOrNumber do:aOneArgBlock |
|
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1668 |
"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
|
1669 |
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
|
1670 |
|
388 | 1671 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1672 |
! |
|
1673 |
||
1674 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1675 |
"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
|
1676 |
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
|
1677 |
|
388 | 1678 |
|item| |
1679 |
||
1680 |
item := self itemAt:stringOrNumber. |
|
1681 |
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
|
1682 |
^ exceptionBlock value |
706 | 1683 |
! |
1684 |
||
1685 |
itemAtIndex:anIndex |
|
1686 |
"returns item at an index or nil |
|
1687 |
" |
|
1688 |
^ 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
|
1689 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1690 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1691 |
items |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1692 |
"returns list of items or nil |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1693 |
" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1694 |
^ items |
388 | 1695 |
! ! |
1696 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1697 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1698 |
|
727 | 1699 |
buttonActiveLevel |
1700 |
"get the button active level |
|
1701 |
" |
|
2219 | 1702 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1703 |
! |
1704 |
||
1705 |
buttonPassiveLevel |
|
2219 | 1706 |
"get the button active level |
1707 |
" |
|
1708 |
^ styleSheet at:#'menuPanel.buttonPassiveLevel' |
|
727 | 1709 |
! |
1710 |
||
2337 | 1711 |
centerItems |
1712 |
^ centerItems ? false |
|
1713 |
! |
|
1714 |
||
1715 |
centerItems:aBoolean |
|
1716 |
centerItems := aBoolean |
|
1717 |
! |
|
1718 |
||
390 | 1719 |
fitFirstPanel |
1720 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1721 |
to the extent of its superView |
|
1699 | 1722 |
|
1723 |
NOT SUPPORTED |
|
388 | 1724 |
" |
2219 | 1725 |
^ false |
388 | 1726 |
! |
1727 |
||
390 | 1728 |
fitFirstPanel:aState |
1729 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1730 |
to the extent of its superView |
|
1699 | 1731 |
|
1732 |
NOT SUPPORTED |
|
1733 |
" |
|
616 | 1734 |
! |
1735 |
||
1093 | 1736 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1737 |
anInt ~~ level ifTrue:[ |
2219 | 1738 |
super level:anInt. |
1739 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1740 |
] |
2052 | 1741 |
|
1742 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1743 |
! |
1744 |
||
616 | 1745 |
rightArrow |
2374 | 1746 |
rightArrow isNil ifTrue:[ |
1747 |
device isNil ifTrue:[ |
|
2219 | 1748 |
^ SelectionInListView rightArrowFormOn:Display |
1749 |
]. |
|
1750 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
1751 |
]. |
|
616 | 1752 |
^ rightArrow |
1753 |
! |
|
1754 |
||
1755 |
rightArrowShadow |
|
1756 |
^ rightArrowShadow |
|
388 | 1757 |
! |
1758 |
||
390 | 1759 |
showGroupDivider |
1760 |
"get the enabled flag for showing groupDiveders |
|
388 | 1761 |
" |
2253 | 1762 |
^ showGroupDivider |
388 | 1763 |
! |
1764 |
||
390 | 1765 |
showGroupDivider:aState |
1766 |
"set the enabled flag for showing groupDiveders |
|
388 | 1767 |
" |
2253 | 1768 |
showGroupDivider ~~ aState ifTrue:[ |
1769 |
showGroupDivider := aState. |
|
1770 |
self mustRearrange. |
|
653 | 1771 |
] |
388 | 1772 |
! |
1773 |
||
1774 |
showSeparatingLines |
|
1775 |
"gets true if drawing of separating lines is enabled. |
|
1776 |
" |
|
2253 | 1777 |
^ showSeparatingLines |
388 | 1778 |
! |
1779 |
||
390 | 1780 |
showSeparatingLines:aState |
388 | 1781 |
"turn on/off drawing of separating lines. |
1782 |
" |
|
2253 | 1783 |
aState ~~ showSeparatingLines ifTrue:[ |
1784 |
showSeparatingLines := aState. |
|
1785 |
self mustRearrange |
|
1786 |
]. |
|
388 | 1787 |
! |
1788 |
||
1789 |
verticalLayout |
|
1790 |
"get the layout: or vertical( true ) or horizontal( false ) |
|
1791 |
" |
|
2374 | 1792 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 1793 |
|
1794 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
1795 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
|
1796 |
||
2374 | 1797 |
^ verticalLayout |
388 | 1798 |
! |
1799 |
||
1800 |
verticalLayout:aState |
|
1801 |
"set the layout: or vertical( true ) or horizontal( false ) |
|
1802 |
" |
|
2253 | 1803 |
aState ~~ verticalLayout ifTrue:[ |
1804 |
verticalLayout isNil ifTrue:[ |
|
1805 |
verticalLayout := aState |
|
1806 |
] ifFalse:[ |
|
1807 |
verticalLayout := aState. |
|
1808 |
self mustRearrange. |
|
1809 |
]. |
|
1810 |
]. |
|
388 | 1811 |
! ! |
1812 |
||
2219 | 1813 |
!MenuPanel methodsFor:'accessing-style'! |
1814 |
||
1815 |
buttonInsetX |
|
1816 |
"returns the verical button space |
|
1817 |
" |
|
1818 |
^ styleSheet at:#'menuPanel.buttonInsetX' |
|
1819 |
! |
|
1820 |
||
1821 |
buttonInsetY |
|
1822 |
"returns the verical button space |
|
1823 |
" |
|
1824 |
^ styleSheet at:#'menuPanel.buttonInsetY' |
|
1825 |
! |
|
1826 |
||
1827 |
enteredLevel |
|
1828 |
"returns the enter-level for an unselected item moved through |
|
1829 |
" |
|
1830 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
|
1831 |
! |
|
1832 |
||
1833 |
groupDividerSize |
|
1834 |
"returns the width of a group divider |
|
1835 |
" |
|
1836 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
|
1837 |
! |
|
1838 |
||
1839 |
itemMargin |
|
1840 |
"returns the margin of an item |
|
1841 |
" |
|
1842 |
^ styleSheet at:#'menu.itemMargin' default:0 |
|
1843 |
! |
|
1844 |
||
1845 |
itemSpace |
|
1846 |
"returns the additional space for an item in a (vertical) panel |
|
1847 |
" |
|
1848 |
^ styleSheet at:#'menuPanel.itemSpace' |
|
1849 |
! |
|
1850 |
||
1851 |
selectionFollowsMouse |
|
1852 |
"returns true if the selection follows the mouse |
|
1853 |
" |
|
1854 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
|
1855 |
! |
|
1856 |
||
1857 |
shortcutKeyOffset |
|
1858 |
"returns the offset for a shortcutKey |
|
1859 |
" |
|
1860 |
^ 5 |
|
1861 |
! ! |
|
1862 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1863 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 1864 |
|
1865 |
subMenuAt:stringOrNumber |
|
1866 |
"gets the submenu of an item or nil |
|
1867 |
" |
|
1868 |
^ self itemAt:stringOrNumber do:[:el| el submenu ] |
|
1869 |
! |
|
1870 |
||
1871 |
subMenuAt:stringOrNumber put:aSubMenu |
|
1872 |
"sets the submenu of an item |
|
1873 |
" |
|
1874 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
|
1875 |
||
1876 |
! |
|
1877 |
||
1878 |
subMenuShown |
|
1879 |
"return the currently visible submenu - or nil if there is none |
|
1880 |
" |
|
1881 |
|item| |
|
1882 |
||
1883 |
(item := self selection) notNil ifTrue:[ |
|
2145 | 1884 |
^ item submenu |
388 | 1885 |
]. |
1886 |
^ nil |
|
1887 |
! ! |
|
1888 |
||
2504 | 1889 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 1890 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1891 |
closeMenus |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1892 |
"close all menus; operation is done; nothing accepted |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1893 |
" |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1894 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1895 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1896 |
|
388 | 1897 |
hide |
1898 |
"hide the view, leave its modal event loop |
|
1899 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1900 |
|
2407 | 1901 |
"/ TODO: replace with LeaveSignal raise. |
1902 |
||
388 | 1903 |
self selection:nil. |
1904 |
self unmap. |
|
1905 |
! |
|
1906 |
||
1907 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1908 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1909 |
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
|
1910 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1911 |
to some performer) |
388 | 1912 |
" |
1913 |
^ self showAt:(self origin) resizing:true |
|
1914 |
||
1915 |
! |
|
1916 |
||
1917 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1918 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1919 |
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
|
1920 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1921 |
to some performer) |
388 | 1922 |
" |
1923 |
^ self showAt:aPoint resizing:true |
|
1924 |
||
1925 |
||
1926 |
! |
|
1927 |
||
1928 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1929 |
"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
|
1930 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1931 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1932 |
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
|
1933 |
menu (i.e. the view or controller), which will perform the action |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1934 |
if a non-nil is returned. |
388 | 1935 |
" |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1936 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1937 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 1938 |
|
1939 |
aBoolean ifTrue:[ |
|
2219 | 1940 |
self fixSize. |
388 | 1941 |
]. |
1942 |
self origin:aPoint. |
|
1459 | 1943 |
"/ self makeFullyVisible. -- done in realize |
388 | 1944 |
self openModal:[true]. "realize " |
1945 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1946 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1947 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1948 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1949 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
2219 | 1950 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1951 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1952 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1953 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1954 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1955 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 1956 |
! |
1957 |
||
1958 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1959 |
"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
|
1960 |
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
|
1961 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1962 |
to some performer) |
388 | 1963 |
" |
1964 |
^ self showAt:(device pointerPosition) resizing:true |
|
1965 |
||
1966 |
||
1967 |
! |
|
1968 |
||
1969 |
showCenteredIn:aView |
|
1970 |
"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
|
1971 |
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
|
1972 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1973 |
to some performer) |
388 | 1974 |
" |
1975 |
|top| |
|
1976 |
||
1977 |
top := aView topView. |
|
1978 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1979 |
^ 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
|
1980 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1981 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 1982 |
! |
1983 |
||
1984 |
startUp |
|
1985 |
"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
|
1986 |
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
|
1987 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1988 |
to some performer) |
388 | 1989 |
" |
1990 |
^ self showAtPointer |
|
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1991 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1992 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1993 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1994 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1995 |
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
|
1996 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1997 |
to some performer) |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1998 |
" |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1999 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2000 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2001 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2002 |
! |
2003 |
||
2332 | 2004 |
startUpFor:originatingWidget |
2005 |
"realize the menu at the current pointer position |
|
2006 |
return the value of the selectedItem or nil, of none was selected |
|
2007 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2008 |
to some performer) |
|
2009 |
" |
|
2010 |
originator := originatingWidget. |
|
2011 |
^ self startUp |
|
2012 |
! |
|
2013 |
||
1750 | 2014 |
startUpOrNil |
2015 |
"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
|
2016 |
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
|
2017 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2018 |
to some performer) |
1750 | 2019 |
" |
2020 |
^ self showAtPointer |
|
388 | 2021 |
! ! |
2022 |
||
2023 |
!MenuPanel methodsFor:'adding & removing'! |
|
2024 |
||
2025 |
createAtIndex:anIndexOrNil |
|
1800 | 2026 |
"create an item and add this item to the index. In case of nil, the item |
2027 |
is added to the end. If the index is not valid nil is returned; |
|
2028 |
otherwise the new created item is returned. |
|
388 | 2029 |
" |
2030 |
|max item| |
|
2031 |
||
2032 |
max := (items size) + 1. |
|
2033 |
||
2034 |
anIndexOrNil notNil ifTrue:[ |
|
2219 | 2035 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2036 |
^ nil |
|
2037 |
] |
|
388 | 2038 |
]. |
2039 |
items isNil ifTrue:[ |
|
2219 | 2040 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2041 |
] ifFalse:[ |
2219 | 2042 |
items := items asOrderedCollection |
388 | 2043 |
]. |
2044 |
item := Item in:self. |
|
2045 |
||
2046 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
2219 | 2047 |
items add:item |
388 | 2048 |
] ifFalse:[ |
2219 | 2049 |
items add:item beforeIndex:anIndexOrNil |
388 | 2050 |
]. |
2051 |
^ item |
|
2052 |
! |
|
2053 |
||
2054 |
remove:stringOrNumber |
|
2055 |
"remove the first item which is assigned to stringOrNumber; |
|
2056 |
if found, remove and return it |
|
2057 |
" |
|
2058 |
|item| |
|
2059 |
||
2060 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
2145 | 2061 |
items remove:item. |
2062 |
item destroy. |
|
2063 |
items isEmpty ifTrue:[items := nil]. |
|
2064 |
self mustRearrange. |
|
388 | 2065 |
]. |
2066 |
^ item |
|
2067 |
! |
|
2068 |
||
2069 |
removeAll |
|
2070 |
"remove all items and submenus |
|
2071 |
" |
|
2072 |
self disabledRedrawDo:[ |
|
2219 | 2073 |
self selection:nil. |
2074 |
groupSizes := nil. |
|
2075 |
items notNil ifTrue:[ |
|
2076 |
items copy do:[:el| el destroy ]. |
|
2077 |
]. |
|
2078 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2079 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2080 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2081 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2082 |
! ! |
2083 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2084 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2085 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2086 |
update:something with:aParameter from:changedObject |
498 | 2087 |
|
2088 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2089 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2090 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2091 |
super update:something with:aParameter from:changedObject |
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 |
|
388 | 2094 |
!MenuPanel methodsFor:'converting'! |
2095 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2096 |
asMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2097 |
"convert contents to menu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2098 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2099 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2100 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2101 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2102 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2103 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2104 |
^ menu |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2105 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2106 |
|
388 | 2107 |
fromSpec:aMenuSpec |
2108 |
"build from spec |
|
2109 |
" |
|
2110 |
|menu| |
|
2111 |
||
2112 |
menu := Menu new. |
|
2113 |
menu fromLiteralArrayEncoding:aMenuSpec. |
|
2114 |
self menu:menu |
|
2115 |
||
2116 |
! |
|
2117 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2118 |
menu:aMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2119 |
"convert to Menu |
388 | 2120 |
" |
2121 |
self disabledRedrawDo:[ |
|
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2122 |
|menu newItems menuReceiver| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2123 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2124 |
self removeAll. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2125 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2126 |
(menu := aMenu) notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2127 |
(aMenu isCollection) ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2128 |
menu := Menu new. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2129 |
menu fromLiteralArrayEncoding:aMenu. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2130 |
] ifFalse:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2131 |
menuReceiver := menu receiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2132 |
menuReceiver notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2133 |
receiver := menuReceiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2134 |
] |
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 |
(newItems := menu menuItems) size > 0 ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2137 |
items := newItems collect:[:ni | |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2138 |
|i| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2139 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2140 |
i:= Item in:self. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2141 |
i menuItem:ni. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2142 |
i. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2143 |
]. |
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 |
self groupSizes:(menu groupSizes). |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2146 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2147 |
] |
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 |
"Modified: / 8.8.1998 / 02:05:04 / cg" |
388 | 2150 |
! ! |
2151 |
||
2152 |
!MenuPanel methodsFor:'drawing'! |
|
2153 |
||
2154 |
disabledRedrawDo:aBlock |
|
2155 |
"evaluate a block without redrawing within the block; after processing |
|
2156 |
of the block a redraw might be performed |
|
2157 |
" |
|
2158 |
|state| |
|
2159 |
||
2160 |
state := mustRearrange. |
|
2161 |
mustRearrange := true. |
|
2162 |
aBlock value. |
|
2163 |
mustRearrange := state. |
|
2164 |
self mustRearrange |
|
2165 |
! |
|
2166 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2167 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2168 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2169 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2170 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2171 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2172 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2173 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2174 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2175 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2176 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2177 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2178 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2179 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2180 |
level:aLevel |
2219 | 2181 |
shadow:(self buttonShadowColor) |
2182 |
light:(self buttonLightColor) |
|
2183 |
halfShadow:(self buttonHalfShadowColor) |
|
2184 |
halfLight:(self buttonHalfLightColor) |
|
2185 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2186 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2187 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2188 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2189 |
|
2016 | 2190 |
drawItemsX:x y:y width:w height:h |
2191 |
"redraw items and groups in a damage |
|
2192 |
" |
|
2193 |
|isVertical item layout prevClip |
|
2194 |
x1 "{ Class:SmallInteger }" |
|
2195 |
x2 "{ Class:SmallInteger }" |
|
2196 |
y1 "{ Class:SmallInteger }" |
|
2197 |
y2 "{ Class:SmallInteger }" |
|
2198 |
start "{ Class:SmallInteger }" |
|
2199 |
stop "{ Class:SmallInteger }" |
|
2200 |
size "{ Class:SmallInteger }" |
|
2201 |
groupDivInset "{ Class:SmallInteger }" |
|
2202 |
| |
|
2203 |
||
2204 |
size := items size. |
|
2205 |
isVertical := self verticalLayout. |
|
2206 |
||
2207 |
isVertical ifTrue:[ |
|
2064 | 2208 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2016 | 2209 |
start == 0 ifTrue:[ ^ self ]. |
2210 |
y1 := y + h. |
|
2064 | 2211 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
2212 |
startingAt:(start + 1). |
|
2016 | 2213 |
] ifFalse:[ |
2064 | 2214 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2016 | 2215 |
start == 0 ifTrue:[ ^ self ]. |
2216 |
x1 := x + w. |
|
2064 | 2217 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
2218 |
startingAt:(start + 1). |
|
2016 | 2219 |
]. |
2220 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2221 |
||
2253 | 2222 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
2219 | 2223 |
groupDivInset := self groupDividerSize // 2. |
2016 | 2224 |
|
2225 |
groupDivInset ~~ 0 ifTrue:[ |
|
2226 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2227 |
start := start - 1 |
|
2228 |
] |
|
2229 |
]. |
|
2230 |
] ifFalse:[ |
|
2231 |
groupDivInset := 0 |
|
2232 |
]. |
|
2233 |
||
2234 |
prevClip := clipRect. |
|
2235 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2236 |
||
2237 |
start to:stop do:[:i| |
|
2238 |
item := items at:i. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
2239 |
item draw. |
2016 | 2240 |
|
2241 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2242 |
layout := item layout. |
|
2243 |
||
2244 |
isVertical ifTrue:[ |
|
2245 |
x1 := layout left. |
|
2246 |
x2 := layout right. |
|
2247 |
y1 := layout bottom + groupDivInset. |
|
2248 |
y2 := y1. |
|
2249 |
] ifFalse:[ |
|
2250 |
y1 := layout top. |
|
2251 |
y2 := layout bottom. |
|
2252 |
x1 := layout right + groupDivInset. |
|
2253 |
x2 := x1. |
|
2254 |
]. |
|
2255 |
self paint:shadowColor. |
|
2256 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2257 |
self paint:lightColor. |
|
2258 |
||
2259 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2260 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2261 |
||
2262 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2263 |
] |
|
2264 |
]. |
|
2265 |
self clippingRectangle:prevClip. |
|
2266 |
! |
|
2267 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2268 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2269 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2270 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2271 |
isSelected ifTrue:[ |
2219 | 2272 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2273 |
] ifFalse:[ |
2219 | 2274 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2275 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2276 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2277 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2278 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2279 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2280 |
|
1691 | 2281 |
self drawEdgesForX:(layout left) |
2282 |
y:(layout top) |
|
2283 |
width:(layout width) |
|
2284 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2285 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2286 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2287 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2288 |
|
2016 | 2289 |
drawScrollerAt:aDirection bounds:bounds |
2290 |
"draw a scroller |
|
2291 |
" |
|
2292 |
|scrolling icon level x y w h| |
|
2293 |
||
2294 |
x := bounds left. |
|
2295 |
y := bounds top. |
|
2296 |
w := bounds width. |
|
2297 |
h := bounds height. |
|
2298 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2299 |
scrolling := self scrollActivity. |
2016 | 2300 |
|
2301 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2219 | 2302 |
level := -2 |
2016 | 2303 |
] ifFalse:[ |
2219 | 2304 |
level := 1 |
2016 | 2305 |
]. |
2306 |
||
2307 |
level ~~ 0 ifTrue:[ |
|
2219 | 2308 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2309 |
]. |
2310 |
icon := scrolling iconAt:aDirection on:self. |
|
2311 |
||
2312 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2219 | 2313 |
y:(y + (h - icon height // 2)). |
2016 | 2314 |
! |
2315 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2316 |
invalidateItem:anItem repairNow:aBool |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2317 |
"an item changed; invalidate the items layout |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2318 |
" |
2016 | 2319 |
|layout| |
2320 |
||
2073
26c30a04413d
do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents:
2069
diff
changeset
|
2321 |
self sensor isNil ifTrue:[^ self]. |
26c30a04413d
do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents:
2069
diff
changeset
|
2322 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2323 |
(mustRearrange not and:[shown]) ifTrue:[ |
2219 | 2324 |
layout := anItem layout. |
2325 |
||
2326 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2327 |
self invalidate:(layout copy insetBy:-1) repairNow:aBool |
|
2328 |
] |
|
1728 | 2329 |
]. |
2330 |
||
2331 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2332 |
! |
2333 |
||
388 | 2334 |
mustRearrange |
910
5c9592e782fd
always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents:
898
diff
changeset
|
2335 |
"force rearrange (i.e. set the rearrange flag) |
388 | 2336 |
" |
2080 | 2337 |
mustRearrange ifFalse:[ |
2219 | 2338 |
mustRearrange := true. |
2339 |
shown ifTrue:[ |
|
2340 |
self invalidate "/ RepairNow:true |
|
2341 |
] |
|
388 | 2342 |
] |
590 | 2343 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2344 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2345 |
! |
2346 |
||
710 | 2347 |
rearrangeGroups |
1699 | 2348 |
"implements the groupIdentifier #right in a horizontal menu |
2349 |
" |
|
2350 |
|layout point |
|
710 | 2351 |
dltX "{ Class:SmallInteger }" |
2352 |
start "{ Class:SmallInteger }" |
|
2353 |
| |
|
2354 |
||
2355 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
2219 | 2356 |
^ self |
710 | 2357 |
]. |
2358 |
||
2359 |
layout := items last layout. |
|
2360 |
||
1699 | 2361 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2219 | 2362 |
^ self "/ no free space |
710 | 2363 |
]. |
2364 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2365 |
||
2366 |
start == 0 ifTrue:[ |
|
2219 | 2367 |
^ self "/ no item detected |
1699 | 2368 |
]. |
2369 |
point := dltX @ 0. |
|
2370 |
||
2371 |
"/ move items layout to right |
|
710 | 2372 |
|
2373 |
items from:start do:[:anItem| |
|
2219 | 2374 |
anItem isVisible ifTrue:[ |
2375 |
anItem layout moveBy:point. |
|
2376 |
] |
|
710 | 2377 |
]. |
2378 |
! |
|
2379 |
||
388 | 2380 |
rearrangeItems |
1699 | 2381 |
"recompute the layout of each item |
2016 | 2382 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!! |
1699 | 2383 |
" |
1791 | 2384 |
|isVertical extent isPopUpMenu |
2219 | 2385 |
x "{ Class:SmallInteger }" |
2386 |
y "{ Class:SmallInteger }" |
|
2387 |
x0 "{ Class:SmallInteger }" |
|
2388 |
y0 "{ Class:SmallInteger }" |
|
2389 |
x1 "{ Class:SmallInteger }" |
|
2390 |
y1 "{ Class:SmallInteger }" |
|
2391 |
size "{ Class:SmallInteger }" |
|
2392 |
insetX "{ Class:SmallInteger }" |
|
2393 |
insetY "{ Class:SmallInteger }" |
|
2394 |
labelInsetX "{ Class:SmallInteger }" |
|
2395 |
labelInsetY "{ Class:SmallInteger }" |
|
2145 | 2396 |
buttonInsetX "{ Class:SmallInteger }" |
2397 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 2398 |
itemMargin "{ Class:SmallInteger }" |
2399 |
itemSpace "{ Class:SmallInteger }" |
|
2400 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2401 |
| |
1699 | 2402 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2403 |
mustRearrange := false. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2404 |
^ self |
390 | 2405 |
]. |
2219 | 2406 |
|
2080 | 2407 |
"/ DON'T SET THIS!! |
2408 |
"/ item layout: below of first item -> item invalidate |
|
2409 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2410 |
"/ -> invalidate:rapairDamage: |
|
2411 |
"/ -> redrawX:y:width:height: |
|
2412 |
"/ tries to get uninitialized layout from second item. |
|
2413 |
"/ This happens in a modal debugger!! |
|
2414 |
"/ mustRearrange := false. |
|
2219 | 2415 |
isVertical := self verticalLayout. |
2416 |
itemSpace := self itemSpace. |
|
2417 |
groupDividerSize := self groupDividerSize. |
|
2418 |
buttonInsetX := self buttonInsetX. |
|
2419 |
buttonInsetY := self buttonInsetY. |
|
2420 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2421 |
|
2422 |
isPopUpMenu ifFalse:[ |
|
2219 | 2423 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2424 |
] ifTrue:[ |
2145 | 2425 |
labelInsetX := labelInsetY := 0 |
388 | 2426 |
]. |
390 | 2427 |
|
2016 | 2428 |
(isPopUpMenu or:[explicitExtent ~~ true]) ifTrue:[ |savExt maxExt| |
2429 |
savExt := extent := self preferredExtent copy. |
|
1478 | 2430 |
|
1791 | 2431 |
isPopUpMenu ifFalse:[ |
1699 | 2432 |
isVertical ifTrue:[extent y:1.0] ifFalse:[extent x:1.0] |
2016 | 2433 |
] ifTrue:[ |
2434 |
savExt := extent copy. |
|
2435 |
maxExt := self maxExtent. |
|
2436 |
||
2437 |
isVertical ifTrue:[ |
|
2438 |
extent y:(extent y min:(maxExt y)) |
|
2439 |
] ifFalse:[ |
|
2440 |
extent x:(extent x min:(maxExt x)) |
|
2441 |
] |
|
1478 | 2442 |
]. |
2016 | 2443 |
self extent:extent. |
2444 |
extent := savExt. |
|
390 | 2445 |
] ifFalse:[ |
1699 | 2446 |
extent := self computeExtent |
390 | 2447 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2448 |
|
1093 | 2449 |
x := y := margin. |
2450 |
||
1699 | 2451 |
isVertical ifFalse:[ |
2452 |
y0 := margin. |
|
2453 |
y1 := extent y - margin. |
|
2454 |
||
2455 |
items keysAndValuesDo:[:anIndex :el| |
|
2456 |
el isVisible ifFalse:[ |
|
2457 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2458 |
] ifTrue:[ |
|
1478 | 2459 |
el isButton ifTrue:[ |
2145 | 2460 |
insetX := buttonInsetX. |
2461 |
insetY := buttonInsetY. |
|
2062 | 2462 |
] ifFalse:[ |
2145 | 2463 |
insetX := labelInsetX. |
2464 |
insetY := labelInsetY. |
|
1478 | 2465 |
]. |
2145 | 2466 |
x0 := x + insetX. |
2171 | 2467 |
x1 := x0 + (el preferredExtent x). |
2145 | 2468 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
2469 |
x := x1 + insetX. |
|
1699 | 2470 |
|
2471 |
size ~~ anIndex ifTrue:[ |
|
2472 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2473 |
x := x + groupDividerSize |
|
2474 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2475 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2476 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2477 |
] |
1699 | 2478 |
] |
2479 |
] |
|
1478 | 2480 |
]. |
1699 | 2481 |
]. |
2482 |
] ifTrue:[ |
|
2219 | 2483 |
itemMargin := self itemMargin. |
1699 | 2484 |
x0 := margin. |
2219 | 2485 |
x1 := extent x - margin - itemMargin. "/ -1 |
1699 | 2486 |
|
2487 |
items keysAndValuesDo:[:anIndex :el| |
|
2488 |
el isVisible ifFalse:[ |
|
2489 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2490 |
] ifTrue:[ |
|
2491 |
el isButton ifTrue:[ |
|
2145 | 2492 |
insetX := buttonInsetX. |
2493 |
insetY := buttonInsetY. |
|
1699 | 2494 |
] ifFalse:[ |
2145 | 2495 |
insetX := labelInsetX. |
2496 |
insetY := labelInsetY. |
|
1699 | 2497 |
]. |
2145 | 2498 |
y0 := y + insetY. |
1699 | 2499 |
y1 := y0 + el preferredExtent y. |
2219 | 2500 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
2145 | 2501 |
y := y1 + insetY. |
1699 | 2502 |
|
2503 |
size ~~ anIndex ifTrue:[ |
|
2504 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2505 |
y := y + groupDividerSize |
|
2506 |
] |
|
2507 |
] |
|
1478 | 2508 |
] |
2509 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2510 |
]. |
710 | 2511 |
self rearrangeGroups. |
2048 | 2512 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2513 |
mustRearrange := false. |
2048 | 2514 |
|
2515 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2516 |
! |
2517 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2518 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2519 |
"check for items which can change its visibility; |
2520 |
if at least one item exists, rearrange all items |
|
2521 |
" |
|
1464 | 2522 |
items isNil ifTrue:[^ self]. |
1699 | 2523 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2524 |
items do:[:item | |
2219 | 2525 |
item canChangeVisibility ifTrue:[ |
2526 |
mustRearrange := true. |
|
2527 |
self rearrangeItems. |
|
2528 |
^ self |
|
2529 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2530 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2531 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2532 |
|
388 | 2533 |
redrawX:x y:y width:w height:h |
2016 | 2534 |
"redraw a damage |
2535 |
" |
|
2052 | 2536 |
|y0 y1 x0 x1 bounds mustDrawPrevScroller mustDrawNextScroller| |
388 | 2537 |
|
710 | 2538 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2539 |
|
1699 | 2540 |
mustRearrange ifTrue:[ |
2569 | 2541 |
self isPopUpView ifFalse:[explicitExtent := true]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2542 |
self rearrangeItems. |
2569 | 2543 |
self invalidate. |
2544 |
^ self |
|
1699 | 2545 |
]. |
2219 | 2546 |
self paint:(self viewBackground). |
1699 | 2547 |
self clearRectangleX:x y:y width:w height:h. |
2548 |
||
2016 | 2549 |
items size == 0 ifTrue:[ |
1699 | 2550 |
^ self |
2551 |
]. |
|
2016 | 2552 |
y0 := y. |
2553 |
y1 := y + h. |
|
2018 | 2554 |
x0 := x. |
2555 |
x1 := x + w. |
|
2016 | 2556 |
|
2557 |
self hasScrollers ifTrue:[ |
|
2558 |
(self hasScrollerAt:#PREV) ifTrue:[ |
|
2559 |
bounds := self scrollerBoundsAt:#PREV. |
|
2052 | 2560 |
mustDrawPrevScroller := false. |
2016 | 2561 |
|
2018 | 2562 |
self verticalLayout ifTrue:[ |
2563 |
bounds bottom > y ifTrue:[ |
|
2564 |
y0 := bounds bottom. |
|
2052 | 2565 |
mustDrawPrevScroller := true. |
2018 | 2566 |
]. |
2567 |
] ifFalse:[ |
|
2568 |
bounds right > x ifTrue:[ |
|
2569 |
x0 := bounds right. |
|
2052 | 2570 |
mustDrawPrevScroller := true. |
2018 | 2571 |
]. |
2052 | 2572 |
]. |
2573 |
mustDrawPrevScroller ifTrue:[ |
|
2574 |
self drawScrollerAt:#PREV bounds:bounds. |
|
2575 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2576 |
]. |
2016 | 2577 |
|
2578 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
|
2579 |
bounds := self scrollerBoundsAt:#NEXT. |
|
2052 | 2580 |
mustDrawNextScroller := false. |
2016 | 2581 |
|
2018 | 2582 |
self verticalLayout ifTrue:[ |
2583 |
bounds top < y1 ifTrue:[ |
|
2584 |
y1 := bounds top. |
|
2052 | 2585 |
mustDrawNextScroller := true. |
2018 | 2586 |
] |
2587 |
] ifFalse:[ |
|
2588 |
bounds left < x1 ifTrue:[ |
|
2589 |
x1 := bounds left. |
|
2052 | 2590 |
mustDrawNextScroller := true. |
2018 | 2591 |
] |
2052 | 2592 |
]. |
2593 |
mustDrawNextScroller ifTrue:[ |
|
2594 |
self drawScrollerAt:#NEXT bounds:bounds. |
|
2595 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2596 |
] |
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2597 |
]. |
2018 | 2598 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
2599 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
|
2016 | 2600 |
]. |
2052 | 2601 |
|
2602 |
"Modified: / 15.11.2001 / 20:57:32 / cg" |
|
388 | 2603 |
! ! |
2604 |
||
2605 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2606 |
||
2607 |
collect:aOneArgBlock |
|
2608 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2609 |
and return a collection of the results |
|
2610 |
" |
|
2611 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
|
2059 | 2612 |
^ nil |
388 | 2613 |
! |
2614 |
||
2615 |
do:aOneArgBlock |
|
2616 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel. |
|
2617 |
" |
|
2618 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
|
2619 |
||
2620 |
! |
|
2621 |
||
2622 |
findFirst:aOneArgBlock |
|
2623 |
"find the first item, for which evaluation of the argument, aOneArgBlock |
|
2624 |
returns true; return its index or 0 if none detected. |
|
2625 |
" |
|
2626 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
|
2627 |
^ 0 |
|
2628 |
||
2629 |
! |
|
2630 |
||
2631 |
findLast:aOneArgBlock |
|
2632 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2633 |
returns true; return its index or 0 if none detected. |
|
2634 |
" |
|
2635 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
|
2636 |
^ 0 |
|
2637 |
||
2638 |
! |
|
2639 |
||
390 | 2640 |
indexOf:something |
2641 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2642 |
If no item match 0 is returned. No range checks are performed on a number argument |
|
388 | 2643 |
" |
390 | 2644 |
|i v| |
2645 |
||
2646 |
something isNumber ifTrue:[ ^ something ]. |
|
2647 |
something isNil ifTrue:[ ^ 0 ]. |
|
2648 |
||
1218 | 2649 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2650 |
|
2651 |
i ~~ 0 ifTrue:[ |
|
2145 | 2652 |
^ i |
388 | 2653 |
]. |
390 | 2654 |
|
2655 |
something isSymbol ifTrue:[ |
|
2145 | 2656 |
i := self findFirst:[:el| |
2657 |
v := el value. |
|
2658 |
v isSymbol and:[v == something] |
|
2659 |
]. |
|
2660 |
i ~~ 0 ifTrue:[ |
|
2661 |
^ i |
|
2662 |
] |
|
390 | 2663 |
]. |
2664 |
||
2665 |
(something respondsTo:#string) ifTrue:[ |
|
2145 | 2666 |
v := something string. |
1218 | 2667 |
^ self findFirst:[:el | el textLabel = v]. |
2668 |
]. |
|
2669 |
^ 0 |
|
388 | 2670 |
! |
2671 |
||
706 | 2672 |
indexOfItem:anItem |
2673 |
"returns the index of the item or 0 |
|
2674 |
" |
|
2675 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
|
2676 |
! |
|
2677 |
||
388 | 2678 |
keysAndValuesDo:aTwoArgBlock |
2679 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel. |
|
2680 |
" |
|
2681 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
|
2682 |
||
2683 |
! ! |
|
2684 |
||
2685 |
!MenuPanel methodsFor:'event handling'! |
|
2686 |
||
2687 |
buttonMotion:state x:x y:y |
|
2688 |
"open or close the corresponding submenus |
|
2689 |
" |
|
2046 | 2690 |
|menue motionPoint translatedPoint sensor| |
1699 | 2691 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2692 |
self scrollActivity isActive ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2693 |
^ self |
2016 | 2694 |
]. |
2695 |
||
1699 | 2696 |
sensor := self sensor. |
2697 |
||
2698 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2699 |
^ self |
1699 | 2700 |
]. |
2701 |
menue := self detectGrabMenu. |
|
1841 | 2702 |
|
2046 | 2703 |
motionPoint := x@y. |
2704 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 2705 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 2706 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2707 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2708 |
|
1699 | 2709 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2710 |
^ self |
1699 | 2711 |
]. |
2712 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2713 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2714 |
"/ 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
|
2715 |
(self containsPoint:motionPoint) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2716 |
^ self accept:nil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2717 |
] |
1699 | 2718 |
]. |
2719 |
||
2048 | 2720 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 2721 |
! |
2722 |
||
2723 |
buttonPress:button x:x y:y |
|
2724 |
"any button pressed; open or close the corresponding submenus |
|
2725 |
" |
|
2016 | 2726 |
|menu point| |
2727 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2728 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2729 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2730 |
self scrollActivity stop. |
2016 | 2731 |
point := x@y. |
2732 |
menu := self detectMenuAtGrabPoint:point. |
|
2733 |
||
2734 |
menu isNil ifTrue:[ |
|
2133
293dadf237ad
hide on buttonRelease outside (instead of buttonPress outside)
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
2735 |
"/ self accept:nil |
2016 | 2736 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2737 |
point := menu translateGrabPoint:point. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2738 |
menu handleButtonPressAtPoint:point. |
2016 | 2739 |
] |
2046 | 2740 |
|
2741 |
"Modified: / 13.11.2001 / 14:12:32 / cg" |
|
1699 | 2742 |
! |
2743 |
||
2744 |
buttonRelease:button x:x y:y |
|
2745 |
"button release action; accept selection and close all views |
|
2746 |
" |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2747 |
|topMenu dstMenu item srcPoint dstPoint subm doAction| |
2199 | 2748 |
|
2749 |
topMenu := self topMenu. |
|
2750 |
topMenu openDelayed:nil. |
|
1699 | 2751 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2752 |
self scrollActivity stop ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2753 |
^ self |
2016 | 2754 |
]. |
2755 |
||
1699 | 2756 |
dstMenu := topMenu activeMenu. |
2757 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2758 |
doAction := dstMenu selection notNil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2759 |
or:[dstMenu isPopUpView not]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2760 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2761 |
doAction ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2762 |
doAction := hideOnRelease. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2763 |
((OperatingSystem |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2764 |
millisecondTimeDeltaBetween:(Time millisecondClockValue) |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2765 |
and:(dstMenu mapTime)) |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2766 |
> (PopUpMenu maxClickTimeToStayOpen)) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2767 |
doAction := false |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2768 |
] |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2769 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2770 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2771 |
doAction ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2772 |
srcPoint := x@y. |
1699 | 2773 |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2774 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2775 |
and:[(item := dstMenu selection) notNil] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2776 |
) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2777 |
item visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2778 |
dstMenu selection:nil. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2779 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2780 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2781 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2782 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2783 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2784 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2785 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2786 |
subm := item currentSubmenu. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2787 |
|
2374 | 2788 |
subm notNil ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2789 |
subm shown ifTrue:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2790 |
"/ test whether any action is assigned to the menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2791 |
"/ if not ignorre accept |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2792 |
item hasDelayedMenu ifFalse:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2793 |
"/ handle action defined for the delayed menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2794 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2795 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2796 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2797 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2798 |
item := nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2799 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2800 |
topMenu acceptItem:item inMenu:dstMenu. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2801 |
^ self |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2802 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2803 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2804 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2805 |
selection visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2806 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2807 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2808 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2809 |
self accept:nil. |
1699 | 2810 |
]. |
2811 |
! |
|
2812 |
||
2813 |
keyPress:key x:x y:y |
|
2814 |
"any key is pressed |
|
2815 |
" |
|
2251 | 2816 |
|menu superMenu sensor| |
2817 |
||
2818 |
sensor := self sensor. |
|
2374 | 2819 |
sensor isNil ifTrue:[^ self]. |
2251 | 2820 |
|
2821 |
sensor anyButtonPressed ifTrue:[ |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
2822 |
^ self "/ ignored while any button is pressed |
2251 | 2823 |
]. |
1699 | 2824 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2825 |
self scrollActivity isActive ifTrue:[ |
2016 | 2826 |
key ~~ #Escape ifTrue:[ |
2827 |
^ self |
|
2828 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2829 |
self scrollActivity stop |
2016 | 2830 |
]. |
2831 |
||
1699 | 2832 |
(key == #Tab |
2833 |
or:[key == #FocusNext |
|
2834 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
2835 |
self accept:nil. |
|
2374 | 2836 |
^ super keyPress:key x:x y:y |
1699 | 2837 |
]. |
2838 |
||
2839 |
menu := self detectGrabMenu. |
|
2251 | 2840 |
superMenu := menu superMenu. |
1699 | 2841 |
|
2842 |
key == #Escape ifTrue:[ |
|
2843 |
"/ must hide the active menu |
|
2251 | 2844 |
(superMenu notNil and:[superMenu ~~ self]) ifTrue:[ |
1703 | 2845 |
"/ hide active menu but keep the grab |
2251 | 2846 |
superMenu selection:nil |
1699 | 2847 |
] ifFalse:[ |
1703 | 2848 |
"/ hide active menu and ungrab |
1699 | 2849 |
self accept:nil |
2251 | 2850 |
]. |
2851 |
^ self |
|
2852 |
]. |
|
2853 |
||
2854 |
menu isViewWrapper ifFalse:[ |
|
2855 |
sensor compressKeyPressEventsWithKey:key. |
|
2856 |
menu handleKeyPress:key. |
|
2374 | 2857 |
^ self |
2251 | 2858 |
]. |
2859 |
superMenu == self ifFalse:[^ self]. |
|
2860 |
||
2861 |
"/ allow cursor movement |
|
2862 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
2863 |
(self containsPoint:x@y) ifTrue:[ |
|
2864 |
self handleKeyPress:key. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2865 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2866 |
]. |
1699 | 2867 |
! |
2868 |
||
2869 |
pointerLeave:state |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2870 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2871 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2872 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 2873 |
|
1699 | 2874 |
self detectGrabMenu handlePointerLeave:state. |
2875 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2876 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
2251 | 2877 |
^ self |
2878 |
]. |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2879 |
|
2374 | 2880 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2881 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2882 |
windowGroup focusView ~~ self ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2883 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2884 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2885 |
selection isButton ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2886 |
sensor := self sensor. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2887 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2888 |
sensor isNil ifTrue:[ |
2251 | 2889 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2890 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2891 |
"/ I'have the focus; if no button pressed, than keep the selection |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2892 |
sensor anyButtonPressed ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2893 |
self selection:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2894 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2895 |
]. |
2251 | 2896 |
] |
1699 | 2897 |
]. |
2898 |
! |
|
2899 |
||
2900 |
sizeChanged:how |
|
2901 |
"redraw #right groups |
|
2902 |
" |
|
2018 | 2903 |
self isPopUpView ifFalse:[ |
2219 | 2904 |
mustRearrange := true. |
2905 |
shown ifTrue:[ |
|
2906 |
self invalidate |
|
2907 |
] |
|
1699 | 2908 |
]. |
2909 |
super sizeChanged:how |
|
2910 |
! ! |
|
2911 |
||
2503 | 2912 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 2913 |
|
1767 | 2914 |
clearImplicitGrab |
2253 | 2915 |
implicitGrabView := lastPointerView := nil. |
1767 | 2916 |
! |
2917 |
||
2918 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
2919 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
2920 |
|
2253 | 2921 |
|view x y p syntheticEvent menu| |
1767 | 2922 |
|
2923 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
|
2924 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
2925 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
2926 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 2927 |
self sensor leftButtonPressed ifFalse:[ |
2928 |
self clearImplicitGrab. |
|
2929 |
]. |
|
1767 | 2930 |
]. |
2931 |
||
2932 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2253 | 2933 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 2934 |
]. |
2935 |
||
2936 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 2937 |
ev isButtonEvent ifTrue:[ |
2938 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
2939 |
ev view:implicitGrabView. |
|
2940 |
ev arguments at:2 put:p x. |
|
2941 |
ev arguments at:3 put:p y. |
|
2942 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2943 |
||
2944 |
ev isButtonReleaseEvent ifTrue:[ |
|
2945 |
self clearImplicitGrab. |
|
2946 |
]. |
|
2947 |
^ self |
|
2948 |
] |
|
1767 | 2949 |
]. |
2950 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
2951 |
||
2016 | 2952 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
2253 | 2953 |
self clearImplicitGrab. |
1767 | 2954 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
2955 |
]. |
|
2956 |
||
2957 |
p := menu translateGrabPoint:(x@y). |
|
2958 |
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
|
2959 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 2960 |
|
2961 |
ev isButtonPressEvent ifTrue:[ |
|
2253 | 2962 |
(view wantsFocusWithButtonPress) ifTrue:[ |
2963 |
view requestFocus. |
|
2964 |
]. |
|
2965 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
2966 |
implicitGrabView := view. |
|
2967 |
] |
|
2968 |
]. |
|
1767 | 2969 |
|
2970 |
ev isButtonMotionEvent ifTrue:[ |
|
2253 | 2971 |
lastPointerView ~~ view ifTrue:[ |
2972 |
"/ must generate enter/leave ... (sigh) |
|
2973 |
lastPointerView notNil ifTrue:[ |
|
2974 |
"/ XXX: should be fixed |
|
2975 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
2976 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
2977 |
]. |
|
2978 |
view notNil ifTrue:[ |
|
2979 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
2980 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
2981 |
]. |
|
2982 |
lastPointerView := view. |
|
2983 |
]. |
|
1767 | 2984 |
]. |
2985 |
||
2986 |
ev view:view. |
|
2987 |
ev x:p x. |
|
2988 |
ev y:p y. |
|
2989 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
2990 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
2991 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 2992 |
! |
2993 |
||
2048 | 2994 |
handleButtonMotion:state atPoint:motionPoint |
1699 | 2995 |
"open or close the corresponding submenus |
2996 |
" |
|
2251 | 2997 |
|menu item translatedPoint containsPoint| |
2998 |
||
2999 |
containsPoint := self containsPoint:motionPoint. |
|
3000 |
containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ] |
|
3001 |
ifFalse:[ item := nil ]. |
|
3002 |
||
3003 |
self pointerEntersItem:item. |
|
1699 | 3004 |
|
1910 | 3005 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
2251 | 3006 |
"/ only update pointerEnter |
2048 | 3007 |
^ self |
3008 |
]. |
|
3009 |
||
2251 | 3010 |
containsPoint ifTrue:[ |
3011 |
self selection:item openMenu:true. |
|
2374 | 3012 |
^ self |
2251 | 3013 |
]. |
3014 |
||
3015 |
menu := self superMenuAtPoint:motionPoint. |
|
3016 |
||
2374 | 3017 |
menu notNil ifTrue:[ |
2046 | 3018 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2251 | 3019 |
menu handleButtonMotion:state atPoint:translatedPoint. |
2374 | 3020 |
^ self |
2251 | 3021 |
]. |
3022 |
self isPopUpView ifTrue:[ |
|
3023 |
self selection:nil |
|
3024 |
]. |
|
2046 | 3025 |
! |
3026 |
||
3027 |
handleButtonPressAtPoint:aPoint |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3028 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3029 |
|
2251 | 3030 |
| item sensor direction wasSelected| |
2016 | 3031 |
|
2046 | 3032 |
item := self itemAtPoint:aPoint. |
2374 | 3033 |
item isNil ifTrue:[ |
2251 | 3034 |
self selection:nil openMenu:false. |
2374 | 3035 |
^ self |
2251 | 3036 |
]. |
3037 |
||
3038 |
direction := self scrollerDirectionAtPoint:aPoint. |
|
3039 |
direction notNil ifTrue:[ |
|
3040 |
(self scrollActivity startIfRequiredAt:direction on:self) ifTrue:[ |
|
3041 |
self pointerEntersItem:nil. |
|
3042 |
^ self |
|
2238 | 3043 |
] |
2016 | 3044 |
]. |
2251 | 3045 |
|
3046 |
wasSelected := (selection == item). |
|
3047 |
wasSelected ifFalse:[ |
|
3048 |
self selection:item openMenu:true |
|
3049 |
]. |
|
2199 | 3050 |
item hasDelayedMenu ifTrue:[^ self]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3051 |
|
2238 | 3052 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
2251 | 3053 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3054 |
item toggleSubmenuVisibility |
|
3055 |
]. |
|
2238 | 3056 |
^ self |
3057 |
]. |
|
3058 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3059 |
^ self |
|
3060 |
]. |
|
3061 |
self invalidateItem:item repairNow:true. |
|
3062 |
self acceptItem:item inMenu:self. |
|
3063 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3064 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3065 |
[sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3066 |
sensor flushUserEvents. |
2238 | 3067 |
self selection:nil. |
2046 | 3068 |
|
3069 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3070 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3071 |
! |
3072 |
||
1699 | 3073 |
handleCursorKey:aKey |
388 | 3074 |
"handle a cursor key |
3075 |
" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3076 |
|next menu item isVrt backKey p1 p2 |
2354 | 3077 |
idx0 "{ Class:SmallInteger }" |
687 | 3078 |
idx "{ Class:SmallInteger }" |
1705 | 3079 |
size "{ Class:SmallInteger }" |
687 | 3080 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3081 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3082 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
2354 | 3083 |
^ self |
388 | 3084 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3085 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3086 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3087 |
|
2016 | 3088 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3089 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3090 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3091 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3092 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3093 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3094 |
^ superMenu handleCursorKey:aKey |
1699 | 3095 |
]. |
2016 | 3096 |
idx := 0. |
3097 |
||
3098 |
isVrt ifTrue:[ |
|
3099 |
"/ used because of vertical scrolling |
|
3100 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
2354 | 3101 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
2016 | 3102 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3103 |
] ifFalse:[ |
2016 | 3104 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3105 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3106 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3107 |
|
2354 | 3108 |
idx0 := idx. |
3109 |
size timesRepeat:[ |
|
3110 |
|el| |
|
3111 |
||
3112 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3113 |
||
3114 |
idx > size ifTrue:[ |
|
3115 |
idx := 0 "1" |
|
3116 |
] ifFalse:[ |
|
3117 |
idx < 0 ifTrue:[ |
|
3118 |
idx := size |
|
3119 |
] |
|
3120 |
]. |
|
3121 |
||
3122 |
idx == 0 ifTrue:[ |
|
3123 |
self selection:nil. |
|
3124 |
^ self |
|
3125 |
] ifFalse:[ |
|
3126 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3127 |
el canSelect ifTrue:[ |
|
3128 |
el hasDelayedMenu ifTrue:[ |
|
3129 |
"/ do not open menu |
|
3130 |
self selection:el openMenu:false |
|
3131 |
] ifFalse:[ |
|
3132 |
"/ open comes from style-sheet |
|
3133 |
self selection:el. |
|
3134 |
]. |
|
3135 |
^ self |
|
2249 | 3136 |
]. |
2354 | 3137 |
] |
3138 |
]. |
|
3139 |
idx == idx0 ifTrue:[ |
|
3140 |
^ self |
|
3141 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3142 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3143 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3144 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3145 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3146 |
superMenu notNil ifTrue:[ |
1791 | 3147 |
p1 := self translateGrabPoint:0. |
3148 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3149 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3150 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3151 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3152 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3153 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3154 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3155 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3156 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3157 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3158 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3159 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3160 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3161 |
backKey := #CursorUp. |
1699 | 3162 |
] |
1786
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 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3165 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3166 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3167 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3168 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3169 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3170 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3171 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3172 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3173 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3174 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3175 |
^ self |
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 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3179 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3180 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3181 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3182 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3183 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3184 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
2249 | 3185 |
self selectionIndex:item |
1786
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 hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3192 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3193 |
selection toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3194 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3195 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3196 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3197 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3198 |
superMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3199 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3200 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3201 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3202 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3203 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3204 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3205 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3206 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3207 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3208 |
handleKeyPress:key |
1699 | 3209 |
"any key is pressed |
3210 |
" |
|
2219 | 3211 |
|item inMenu| |
1699 | 3212 |
|
3213 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3214 |
self handleReturnPressed |
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 |
key isCharacter ifTrue:[ |
1862 | 3217 |
"/ selection notNil ifTrue:[ |
3218 |
"/ inMenu := self |
|
3219 |
"/ ] ifFalse:[ |
|
3220 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3221 |
"/ ]. |
|
3222 |
inMenu := self. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3223 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3224 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3225 |
inMenu selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3226 |
] |
1699 | 3227 |
] ifFalse:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3228 |
( key == #CursorDown or:[key == #CursorUp |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3229 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3230 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3231 |
self handleCursorKey:key |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3232 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3233 |
] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3234 |
] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3235 |
! |
1699 | 3236 |
|
3237 |
handlePointerLeave:state |
|
3238 |
self pointerEntersItem:nil. |
|
3239 |
super pointerLeave:state |
|
3240 |
! |
|
3241 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3242 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3243 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3244 |
|
2238 | 3245 |
|sensor subm item| |
3246 |
||
3247 |
(item := selection) isNil ifTrue:[ |
|
3248 |
superMenu notNil ifTrue:[ |
|
2249 | 3249 |
item := superMenu selection. |
3250 |
||
3251 |
item value notNil ifTrue:[ |
|
3252 |
"/ is a delayed menu |
|
3253 |
self accept:item |
|
3254 |
] ifFalse:[ |
|
3255 |
item toggleSubmenuVisibility |
|
3256 |
] |
|
2238 | 3257 |
] ifFalse:[ |
3258 |
self accept |
|
3259 |
]. |
|
3260 |
^ self |
|
1841 | 3261 |
]. |
3262 |
selection hasSubmenu ifTrue:[ |
|
2238 | 3263 |
selection hasDelayedMenu ifFalse:[ |
2249 | 3264 |
selection toggleSubmenuVisibility. |
3265 |
^ self |
|
2238 | 3266 |
]. |
3267 |
subm := selection currentSubmenu. |
|
3268 |
||
3269 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
2249 | 3270 |
selection toggleSubmenuVisibility. |
3271 |
^ self |
|
2238 | 3272 |
]. |
3273 |
self openDelayed:nil |
|
1841 | 3274 |
]. |
3275 |
self accept. |
|
3276 |
||
2238 | 3277 |
" test for toggle " |
3278 |
item isToggle ifTrue:[ |
|
3279 |
self selection:item. |
|
3280 |
] ifFalse:[ |
|
3281 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3282 |
^ self |
|
3283 |
] |
|
3284 |
]. |
|
1841 | 3285 |
|
3286 |
(sensor := self sensor) isNil ifTrue:[ |
|
2238 | 3287 |
^ self |
1841 | 3288 |
]. |
3289 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3290 |
[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3291 |
sensor flushKeyboardFor:nil. |
2238 | 3292 |
Delay waitForSeconds:0.1. |
3293 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3294 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3295 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3296 |
|
1699 | 3297 |
pointerEntersItem:anItemOrNil |
3298 |
"the pointer moves over an item or nil; restore the old item and |
|
3299 |
redraw the new item highlighted. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3300 |
" |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3301 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3302 |
|
1699 | 3303 |
( anItemOrNil notNil |
3304 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3305 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3306 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3307 |
anItemOrNil isButton ifTrue:[ |
2219 | 3308 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
3309 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3310 |
) ifTrue:[ |
1699 | 3311 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3312 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3313 |
] ifFalse:[ |
2219 | 3314 |
(self enteredLevel ~~ 0 |
3315 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3316 |
) ifTrue:[ |
|
1699 | 3317 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3318 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3319 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3320 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3321 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3322 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3323 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3324 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3325 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3326 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3327 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3328 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3329 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3330 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3331 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3332 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3333 |
]. |
388 | 3334 |
! ! |
3335 |
||
2251 | 3336 |
!MenuPanel methodsFor:'focus handling'! |
3337 |
||
3338 |
hasKeyboardFocus:aBoolean |
|
3339 |
"notification from the windowGroup that I got/lost the keyboard focus. |
|
3340 |
" |
|
3341 |
|focusView| |
|
3342 |
||
3343 |
self isPopUpView ifTrue:[ |
|
3344 |
"/ not visible for popup menus |
|
3345 |
^ super hasKeyboardFocus:aBoolean |
|
3346 |
]. |
|
3347 |
||
3348 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3349 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3350 |
focusView := windowGroup focusView. |
|
3351 |
||
3352 |
focusView == self ifFalse:[ |
|
3353 |
self selection:nil. |
|
3354 |
] |
|
3355 |
] |
|
3356 |
]. |
|
3357 |
super hasKeyboardFocus:aBoolean. |
|
3358 |
! ! |
|
3359 |
||
388 | 3360 |
!MenuPanel methodsFor:'grabbing'! |
3361 |
||
1699 | 3362 |
doGrab |
3363 |
relativeGrabOrigin := nil. |
|
3364 |
||
3365 |
superMenu notNil ifTrue:[ |
|
2219 | 3366 |
superMenu doGrab |
1699 | 3367 |
] ifFalse:[ |
2219 | 3368 |
hasImplicitGrap ~~ true ifTrue:[ |
3369 |
self grabMouseAndKeyboard. |
|
3370 |
hasImplicitGrap := true |
|
3371 |
] |
|
1699 | 3372 |
] |
3373 |
! |
|
3374 |
||
3375 |
doUngrab:forceDo |
|
3376 |
||
3377 |
relativeGrabOrigin := nil. |
|
1767 | 3378 |
self clearImplicitGrab. |
1699 | 3379 |
|
3380 |
superMenu notNil ifTrue:[ |
|
2219 | 3381 |
forceDo ifTrue:[ |
3382 |
superMenu doUngrab:true |
|
3383 |
]. |
|
3384 |
^ self |
|
1699 | 3385 |
]. |
3386 |
||
3387 |
hasImplicitGrap ~~ true ifTrue:[ |
|
2219 | 3388 |
^ self |
1699 | 3389 |
]. |
3390 |
||
3391 |
forceDo ifFalse:[ |
|
2219 | 3392 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
3393 |
^ self |
|
3394 |
]. |
|
1699 | 3395 |
]. |
3396 |
self ungrabMouseAndKeyboard. |
|
3397 |
self selection:nil. |
|
3398 |
hasImplicitGrap := nil. |
|
1703 | 3399 |
prevFocusView := nil. |
3400 |
||
1699 | 3401 |
! |
3402 |
||
1630 | 3403 |
grabKeyboard |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3404 |
"grap the keyboard; keep previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3405 |
" |
1630 | 3406 |
previousKeyboardGrab := device activeKeyboardGrab. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3407 |
^ super grabKeyboard |
1630 | 3408 |
|
3409 |
||
3410 |
! |
|
3411 |
||
388 | 3412 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3413 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3414 |
|
388 | 3415 |
|sensor| |
3416 |
||
3417 |
realized ifTrue:[ |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3418 |
prevFocusView := self windowGroup focusView. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3419 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3420 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3421 |
device activePointerGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3422 |
sensor flushMotionEventsFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3423 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3424 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3425 |
Delay waitForSeconds:0.1. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3426 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3427 |
"give up" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3428 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3429 |
self unmap |
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 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3432 |
]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3433 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3434 |
device activeKeyboardGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3435 |
device sync. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3436 |
sensor flushKeyboardFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3437 |
self grabKeyboard. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3438 |
] |
388 | 3439 |
] |
3440 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3441 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3442 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3443 |
! |
3444 |
||
1630 | 3445 |
grabPointerWithCursor:aCursorOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3446 |
"grap the pointer; keep previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3447 |
" |
1630 | 3448 |
previousPointerGrab := device activePointerGrab. |
1699 | 3449 |
hasImplicitGrap := true. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3450 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3451 |
|
3452 |
||
3453 |
! |
|
3454 |
||
3455 |
ungrabKeyboard |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3456 |
"ungrap the keyboard; restore previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3457 |
" |
1630 | 3458 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3459 |
|
2579 | 3460 |
(previousKeyboardGrab notNil |
3461 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3462 |
device grabKeyboardInView:previousKeyboardGrab. |
|
3463 |
]. |
|
1630 | 3464 |
! |
3465 |
||
388 | 3466 |
ungrabMouseAndKeyboard |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3467 |
"ungrab resources (mouse and keyboard) |
388 | 3468 |
" |
1630 | 3469 |
self ungrabPointer. |
3470 |
self ungrabKeyboard. |
|
3471 |
! |
|
3472 |
||
3473 |
ungrabPointer |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3474 |
"ungrap the pointer; restore previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3475 |
" |
1630 | 3476 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3477 |
|
2579 | 3478 |
(previousPointerGrab notNil |
3479 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3480 |
device grabPointerInView:previousPointerGrab. |
|
1630 | 3481 |
]. |
3482 |
||
3483 |
||
388 | 3484 |
! ! |
3485 |
||
1251 | 3486 |
!MenuPanel methodsFor:'help'! |
3487 |
||
2058 | 3488 |
flyByHelpTextAt:srcPoint |
3489 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
|
2063 | 3490 |
If there is a selection, that items helpText is used (ignoring the given point). |
2058 | 3491 |
" |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3492 |
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
|
3493 |
^ nil |
2058 | 3494 |
! |
3495 |
||
3496 |
flyByHelpTextForItem:anItem |
|
3497 |
"returns the helpText for an item (empty if none) |
|
3498 |
" |
|
2063 | 3499 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3500 |
^ anItem flyByHelpText. |
2058 | 3501 |
! |
3502 |
||
1251 | 3503 |
helpText |
1613 | 3504 |
"return the helpText for the currently selected item (empty if none) |
3505 |
" |
|
3506 |
^ self helpTextForItem:selection |
|
1251 | 3507 |
! |
3508 |
||
1699 | 3509 |
helpTextAt:srcPoint |
1252 | 3510 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
3511 |
If there is a selection, that items helpText is used (ignoreing the given point). |
|
3512 |
" |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3513 |
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
|
3514 |
^ '' |
1613 | 3515 |
! |
3516 |
||
3517 |
helpTextForItem:anItem |
|
3518 |
"returns the helpText for an item (empty if none) |
|
3519 |
" |
|
3520 |
anItem isNil ifTrue:[^ '']. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3521 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3522 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3523 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3524 |
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
|
3525 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3526 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3527 |
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
|
3528 |
dstMenu notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3529 |
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
|
3530 |
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
|
3531 |
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
|
3532 |
] |
1251 | 3533 |
! ! |
3534 |
||
794 | 3535 |
!MenuPanel methodsFor:'image registration'! |
3536 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
3537 |
imageOnMyDevice:anImage |
794 | 3538 |
"returns image registered on device |
3539 |
" |
|
3540 |
^ self class image:anImage onDevice:device |
|
3541 |
! |
|
3542 |
||
3543 |
lightenedImageOnDevice:anImage |
|
3544 |
"returns lightened image registered on device |
|
3545 |
" |
|
3546 |
^ self class lightenedImage:anImage onDevice:device |
|
3547 |
! ! |
|
3548 |
||
1688 | 3549 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 3550 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3551 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3552 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3553 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3554 |
|
388 | 3555 |
create |
616 | 3556 |
"create the shadow view for a none contained submenu |
388 | 3557 |
" |
3558 |
super create. |
|
3559 |
||
3560 |
self isPopUpView ifTrue:[ |
|
2219 | 3561 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
3562 |
shadowView isNil ifTrue:[ |
|
3563 |
shadowView := (ShadowView onDevice:device) for:self |
|
3564 |
] ifFalse:[ |
|
3565 |
self saveUnder:true. |
|
3566 |
]. |
|
3567 |
] |
|
388 | 3568 |
] ifFalse:[ |
2219 | 3569 |
explicitExtent == true ifTrue:[ |
3570 |
(self width) == (superView width) ifTrue:[ |
|
3571 |
self verticalLayout:false |
|
3572 |
] |
|
3573 |
] |
|
388 | 3574 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3575 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3576 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 3577 |
! |
3578 |
||
3579 |
destroy |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3580 |
"destroy items and shadowView; remove dependencies |
388 | 3581 |
" |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3582 |
self clearLastActiveMenu. |
2051 | 3583 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
3584 |
items := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3585 |
|
498 | 3586 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
3587 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3588 |
|
388 | 3589 |
super destroy. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3590 |
superMenu := nil. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3591 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3592 |
|
2051 | 3593 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3594 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3595 |
|
616 | 3596 |
fetchDeviceResources |
2219 | 3597 |
"fetch device colors, to avoid reallocation at redraw time |
3598 |
" |
|
3599 |
|style| |
|
3600 |
||
2374 | 3601 |
superMenu notNil ifTrue:[ |
2219 | 3602 |
styleSheet := superMenu styleSheet |
3603 |
]. |
|
616 | 3604 |
|
3605 |
super fetchDeviceResources. |
|
3606 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
3607 |
"/ 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
|
3608 |
"/ (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
|
3609 |
|
616 | 3610 |
superMenu isNil ifTrue:[ |
2374 | 3611 |
rightArrow isNil ifTrue:[ |
2219 | 3612 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
2059 | 3613 |
]. |
2219 | 3614 |
fgColor := fgColor onDevice:device. |
3615 |
style := styleSheet name. |
|
3616 |
||
3617 |
(style ~~ #os2 and:[style ~~ #win95]) ifTrue:[ |
|
3618 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
|
3619 |
] ifFalse:[ |
|
3620 |
rightArrowShadow := nil |
|
3621 |
]. |
|
616 | 3622 |
] ifFalse:[ |
2219 | 3623 |
rightArrow := superMenu rightArrow. |
3624 |
rightArrowShadow := superMenu rightArrowShadow. |
|
3625 |
||
3626 |
self foregroundColor:(superMenu foregroundColor). |
|
2614 | 3627 |
self font:(superMenu font). |
2219 | 3628 |
self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3629 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3630 |
|
1829 | 3631 |
items notNil ifTrue:[ |
2219 | 3632 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 3633 |
]. |
3634 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3635 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 3636 |
! |
3637 |
||
580 | 3638 |
initStyle |
3639 |
"initialize style specific stuff" |
|
3640 |
||
2609 | 3641 |
|fn| |
3642 |
||
580 | 3643 |
super initStyle. |
616 | 3644 |
|
2609 | 3645 |
fgColor := DefaultForegroundColor ? Color black. |
3646 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
|
3647 |
fn := self class defaultFont. |
|
2610 | 3648 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 3649 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3650 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3651 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3652 |
self updateLevelAndBorder. |
580 | 3653 |
! |
3654 |
||
388 | 3655 |
initialize |
3656 |
"set default configuration |
|
3657 |
" |
|
3658 |
super initialize. |
|
616 | 3659 |
|
1730
4936edfc2eee
must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
3660 |
self enableMotionEvents. |
498 | 3661 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3662 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3663 |
self originChangedFlag:false. |
2253 | 3664 |
explicitExtent := nil. |
3665 |
shortKeyInset := 0. |
|
3666 |
mustRearrange := false. |
|
3667 |
showSeparatingLines := false. |
|
3668 |
showGroupDivider := true. |
|
388 | 3669 |
! |
3670 |
||
1573 | 3671 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3672 |
"grab the pointer here, when visible (but not if control has already been lost). |
388 | 3673 |
If the grab fails, try again and unmap myself if that fails too. |
3674 |
" |
|
1791 | 3675 |
|loIndices loItems| |
388 | 3676 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3677 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3678 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3679 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3680 |
self becomesActiveMenu. |
1573 | 3681 |
super map. |
388 | 3682 |
|
1785 | 3683 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 3684 |
loItems := items ? #[]. |
3685 |
||
3686 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 3687 |
|
388 | 3688 |
self isPopUpView ifTrue:[ |
2219 | 3689 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3690 |
] ifFalse:[ |
2219 | 3691 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3692 |
]. |
1791 | 3693 |
loItems do:[:el| el updateIndicators ]. |
388 | 3694 |
|
1785 | 3695 |
loIndices size > 0 ifTrue:[ |
2219 | 3696 |
self redrawX:0 y:0 width:width height:height. |
3697 |
self openMenusFromItemIndices:loIndices. |
|
388 | 3698 |
]. |
3699 |
||
1177 | 3700 |
"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
|
3701 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 3702 |
! |
3703 |
||
3704 |
realize |
|
3705 |
"realize menu and shadowView |
|
3706 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3707 |
|
388 | 3708 |
self isPopUpView ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3709 |
"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
|
3710 |
shadowView must be realized before self" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3711 |
self hiddenOnRealize:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3712 |
super realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3713 |
self resize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3714 |
self makeFullyVisible. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3715 |
"/ self mustRearrange. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3716 |
shadowView notNil ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3717 |
shadowView realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3718 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3719 |
self raise. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3720 |
self map. |
736 | 3721 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3722 |
super realize. |
1767 | 3723 |
]. |
3724 |
self allSubViewsDo:[:aView| aView realize ]. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3725 |
hideOnRelease := defaultHideOnRelease. |
388 | 3726 |
! |
3727 |
||
3728 |
recreate |
|
1832 | 3729 |
"this is called after a snapin or a migration. |
3730 |
If the image was saved with an active menu, hide the menu |
|
388 | 3731 |
" |
1455 | 3732 |
selection := nil. |
388 | 3733 |
super recreate. |
3734 |
! |
|
3735 |
||
1130 | 3736 |
reinitStyle |
3737 |
"handle style change while being open (win32 only - for now)" |
|
3738 |
||
3739 |
super reinitStyle. |
|
3740 |
||
3741 |
self fetchDeviceResources. |
|
1811 | 3742 |
self mustRearrange. "/ care for changed font sizes etc. |
3743 |
||
3744 |
self do:[:anItem | |
|
3745 |
anItem reinitStyle |
|
3746 |
]. |
|
1130 | 3747 |
|
3748 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 3749 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 3750 |
! |
3751 |
||
1796
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3752 |
reinitialize |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3753 |
"reinit after a snapIn |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3754 |
" |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3755 |
|
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3756 |
super reinitialize. |
1811 | 3757 |
"/ self reinitStyle. |
3758 |
||
3759 |
"Modified: / 17.8.2000 / 17:53:31 / cg" |
|
1796
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3760 |
! |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3761 |
|
388 | 3762 |
unmap |
1330 | 3763 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
3764 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 3765 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3766 |
self clearLastActiveMenu. |
1699 | 3767 |
self doUngrab:(superMenu isNil). |
3768 |
"/ self isPopUpView ifTrue:[ |
|
3769 |
"/ self doUngrab:(superMenu isNil) |
|
3770 |
"/ ]. |
|
3771 |
||
388 | 3772 |
super unmap. |
3773 |
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
|
3774 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3775 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3776 |
updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3777 |
"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
|
3778 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3779 |
|bw lvl| |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3780 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3781 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3782 |
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
|
3783 |
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
|
3784 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3785 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
2372 | 3786 |
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
|
3787 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3788 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3789 |
self level:lvl. |
388 | 3790 |
! ! |
3791 |
||
1878 | 3792 |
!MenuPanel methodsFor:'keyboard control'! |
3793 |
||
3794 |
mnemonicViewNext:aKeyEvent |
|
3795 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
3796 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
3797 |
return the topMenu otherwise nil. |
|
3798 |
" |
|
2112 | 3799 |
|menu uKey lKey list index| |
3800 |
||
3801 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 3802 |
shown ifFalse:[^ nil]. |
3803 |
||
3804 |
uKey := aKeyEvent rawKey last asUppercase. |
|
3805 |
lKey := uKey asLowercase. |
|
2112 | 3806 |
|
3807 |
selection notNil ifTrue:[ |
|
2374 | 3808 |
"first lookup the current grapMenu before starting in the topMenu |
3809 |
" |
|
3810 |
menu := self detectGrabMenu. |
|
3811 |
||
3812 |
[ menu ~~ self ] whileTrue:[ |
|
3813 |
index := menu selectionIndex. |
|
3814 |
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
|
3815 |
maxDepth:10 from:(index + 1) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3816 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
2112 | 3817 |
|
2374 | 3818 |
list size ~~ 0 ifTrue:[ |
3819 |
"/ has item which responds to the mnemonic |
|
3820 |
menu processCollectedIndices:list. |
|
3821 |
^ self |
|
3822 |
]. |
|
3823 |
menu := menu superMenu. |
|
3824 |
]. |
|
3825 |
index := self selectionIndex. |
|
3826 |
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
|
3827 |
maxDepth:10 from:(1 + index) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3828 |
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
|
3829 |
|
2112 | 3830 |
] ifFalse:[ |
2374 | 3831 |
index := 99999. |
3832 |
list := nil. |
|
2112 | 3833 |
]. |
3834 |
||
2374 | 3835 |
list isNil ifTrue:[ |
3836 |
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
|
3837 |
maxDepth:1 from:1 to:index |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3838 |
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
|
3839 |
|
2374 | 3840 |
|
3841 |
list isNil ifTrue:[ |
|
3842 |
"/ must clear existing selection |
|
3843 |
self selection:nil. |
|
3844 |
^ nil |
|
3845 |
] |
|
2112 | 3846 |
]. |
3847 |
||
3848 |
"/ has item which responds to the mnemonic |
|
3849 |
self processCollectedIndices:list. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3850 |
! |
1878 | 3851 |
|
3852 |
openMenusFromItemIndices:anItemIndiceList |
|
3853 |
"open all menus derived from sequence of item indices |
|
3854 |
" |
|
3855 |
|item| |
|
3856 |
||
3857 |
anItemIndiceList size == 0 ifTrue:[ |
|
2249 | 3858 |
^ self |
1878 | 3859 |
]. |
3860 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
3861 |
||
3862 |
(item notNil and:[item enabled]) ifTrue:[ |
|
2249 | 3863 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
3864 |
self selection:item openMenu:true. |
|
3865 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3866 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3867 |
! |
1878 | 3868 |
|
3869 |
processCollectedIndices:indices |
|
3870 |
|menu item| |
|
3871 |
||
3872 |
indices size == 0 ifTrue:[ |
|
2219 | 3873 |
^ self |
1878 | 3874 |
]. |
3875 |
menu := self. |
|
3876 |
||
3877 |
[menu selectionIndex == indices first] whileTrue:[ |
|
2219 | 3878 |
( (item := menu selection) isNil "/ shouldn't happen |
3879 |
or:[(menu := item submenu) isNil] "/ no more indices; done |
|
3880 |
) ifTrue:[ |
|
3881 |
^ true |
|
3882 |
]. |
|
3883 |
indices removeFirst. |
|
3884 |
||
3885 |
indices isEmpty ifTrue:[ |
|
3886 |
menu selection:nil. |
|
3887 |
^ self |
|
3888 |
] |
|
1878 | 3889 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3890 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3891 |
! |
1878 | 3892 |
|
3893 |
processShortcut:aKeyEvent |
|
3894 |
"a shortcutKey event as forwarded from the keyboardProcessor - if there is the |
|
3895 |
shortcut-key defined process the shortcut and return true otherwise false. |
|
3896 |
" |
|
2219 | 3897 |
|menu rKey lKey list item| |
1878 | 3898 |
|
3899 |
superMenu notNil ifTrue:[ |
|
3900 |
^ superMenu processShortcut:aKeyEvent |
|
3901 |
]. |
|
3902 |
shown ifFalse:[^ false]. |
|
3903 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3904 |
lKey := aKeyEvent key. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3905 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3906 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3907 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3908 |
( #( CursorDown CursorUp CursorRight CursorLeft |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3909 |
) includes:lKey |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3910 |
) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3911 |
^ false. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3912 |
]. |
1878 | 3913 |
rKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3914 |
item := nil. |
1878 | 3915 |
menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu |
3916 |
||
3917 |
[true] whileTrue:[ |
|
3918 |
list := menu selectItemIndicesFor:[:el||skey| |
|
3919 |
item := el. |
|
3920 |
skey := el shortcutKey. |
|
3921 |
skey == rKey or:[skey == lKey] |
|
3922 |
] |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3923 |
maxDepth:10 from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3924 |
ignoreSubmenuBlock:[:anItem| anItem ignoreShortcutKeys ]. |
1878 | 3925 |
|
3926 |
list size ~~ 0 ifTrue:[ |
|
3927 |
"/ has item which responds to the shortcut |
|
3928 |
item hasSubmenu ifFalse:[ |
|
3929 |
menu accept:item |
|
3930 |
] ifTrue:[ |
|
3931 |
menu processCollectedIndices:list. |
|
3932 |
self windowGroup focusView:self. |
|
3933 |
]. |
|
3934 |
^ true |
|
3935 |
]. |
|
3936 |
||
3937 |
menu == self ifTrue:[ ^ false ]. |
|
3938 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3939 |
]. |
2219 | 3940 |
^ false "/ never reached |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3941 |
! |
1878 | 3942 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3943 |
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
|
3944 |
"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
|
3945 |
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
|
3946 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3947 |
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
|
3948 |
is created and passed through if the block returns false. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
3949 |
Otherwise the item is not asked for its submenu. |
2112 | 3950 |
" |
3951 |
|start stop| |
|
3952 |
||
3953 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
3954 |
||
3955 |
start := aStart max:1. |
|
3956 |
stop := aStop min:(items size). |
|
3957 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3958 |
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
|
3959 |
item := items at:i. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3960 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3961 |
(aOneArgBlock value:item) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3962 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3963 |
^ 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
|
3964 |
] |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3965 |
] ifFalse:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3966 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3967 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3968 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3969 |
menu := item submenu. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3970 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3971 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3972 |
result := menu selectItemIndicesFor:aOneArgBlock |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3973 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3974 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
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 |
result notNil ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3977 |
result addFirst:i. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3978 |
^ result |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3979 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3980 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3981 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3982 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3983 |
]. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
3984 |
]. |
1878 | 3985 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3986 |
^ nil |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3987 |
! ! |
1878 | 3988 |
|
388 | 3989 |
!MenuPanel methodsFor:'misc'! |
3990 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3991 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3992 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3993 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3994 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3995 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3996 |
|
388 | 3997 |
superMenu |
3998 |
"returns supermenu or nil |
|
3999 |
" |
|
4000 |
^ superMenu |
|
4001 |
||
4002 |
||
4003 |
! |
|
4004 |
||
4005 |
topMenu |
|
4006 |
"returns the topMenu; the one having no superMenu |
|
4007 |
" |
|
1791 | 4008 |
|menu smenu| |
4009 |
||
4010 |
menu := self. |
|
4011 |
||
4012 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
2219 | 4013 |
menu := smenu |
1791 | 4014 |
]. |
4015 |
^ menu |
|
388 | 4016 |
! ! |
4017 |
||
1825 | 4018 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4019 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4020 |
printString |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4021 |
"return a printed representation of the menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4022 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4023 |
|string label| |
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 := 'Menu:'. |
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 |
self do:[:anItem| |
2145 | 4028 |
label := anItem label ? ''. |
4029 |
string := string ,' ', label printString. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4030 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4031 |
^ string |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4032 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4033 |
"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
|
4034 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4035 |
|
388 | 4036 |
!MenuPanel methodsFor:'private'! |
4037 |
||
434 | 4038 |
application |
1613 | 4039 |
"optimize access to retrive the application |
4040 |
" |
|
2374 | 4041 |
application notNil ifTrue:[^ application ]. |
434 | 4042 |
|
4043 |
superMenu notNil ifTrue:[ |
|
2253 | 4044 |
application := superMenu application. |
2374 | 4045 |
^ application |
2253 | 4046 |
]. |
4047 |
application := super application. |
|
2374 | 4048 |
^ application |
1872 | 4049 |
! |
434 | 4050 |
|
1572 | 4051 |
detectItemForKey:aKey |
4052 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
4053 |
if no item is detected nil is returned. |
|
4054 |
" |
|
4055 |
|cIdx uKey lKey item| |
|
4056 |
||
1699 | 4057 |
items isNil ifTrue:[^ nil]. |
4058 |
||
1572 | 4059 |
cIdx := self selectionIndex. |
4060 |
uKey := aKey asUppercase. |
|
4061 |
lKey := aKey asLowercase. |
|
4062 |
||
1699 | 4063 |
items keysAndValuesDo:[:anIndex :anItem| |char label| |
2219 | 4064 |
( anIndex ~~ cIdx |
4065 |
and:[anItem canSelect |
|
4066 |
and:[(label := anItem textLabel) notNil |
|
4067 |
and:[label size ~~ 0]]] |
|
4068 |
) ifTrue:[ |
|
4069 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4070 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4071 |
^ anItem |
|
4072 |
] |
|
4073 |
] ifFalse:[ |
|
4074 |
char := label at:1. |
|
4075 |
||
4076 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4077 |
anIndex > cIdx ifTrue:[ |
|
4078 |
^ anItem |
|
4079 |
]. |
|
4080 |
item isNil ifTrue:[item := anItem] |
|
4081 |
] |
|
4082 |
] |
|
4083 |
] |
|
1572 | 4084 |
]. |
4085 |
^ item |
|
4086 |
! |
|
4087 |
||
390 | 4088 |
menuAdornmentAt:aSymbol |
388 | 4089 |
"returns a value derived from adornment |
4090 |
" |
|
2374 | 4091 |
adornment isNil ifTrue:[^ nil]. |
4092 |
^ adornment at:aSymbol ifAbsent:nil |
|
388 | 4093 |
! |
4094 |
||
390 | 4095 |
menuAdornmentAt:aSymbol put:something |
2253 | 4096 |
"sets a value for the specific menu |
4097 |
" |
|
4098 |
|oldValue| |
|
4099 |
||
653 | 4100 |
adornment isNil ifTrue:[ |
2374 | 4101 |
something isNil ifTrue:[^ self]. |
2253 | 4102 |
adornment := IdentityDictionary new. |
4103 |
] ifFalse:[ |
|
4104 |
oldValue := adornment at:aSymbol ifAbsent:nil. |
|
4105 |
oldValue == something ifTrue:[^ self]. |
|
653 | 4106 |
]. |
4107 |
adornment at:aSymbol put:something. |
|
388 | 4108 |
! |
4109 |
||
4110 |
onEachPerform:aSelector withArgList:aList |
|
4111 |
"on each item perform selector with an argument derived from aList |
|
4112 |
" |
|
4113 |
aList isCollection ifTrue:[ |
|
2145 | 4114 |
items size >= aList size ifTrue:[ |
4115 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4116 |
(items at:anIndex) perform:aSelector with:anArg |
|
4117 |
] |
|
4118 |
] |
|
388 | 4119 |
] ifFalse:[ |
2145 | 4120 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4121 |
] |
4122 |
||
4123 |
||
4124 |
! |
|
4125 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4126 |
registerImageOnDevice:anImage |
2269 | 4127 |
|
4128 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4129 |
^ self class image:anImage onDevice:device |
|
4130 |
||
4131 |
"/ |image| |
|
4132 |
"/ |
|
4133 |
"/ (image := anImage) notNil ifTrue:[ |
|
4134 |
"/ image device ~~ device ifTrue:[ |
|
4135 |
"/ image := image copy. |
|
4136 |
"/ ]. |
|
4137 |
"/ image := image onDevice:device. |
|
4138 |
"/ image := image clearMaskedPixels. |
|
4139 |
"/ ]. |
|
4140 |
"/ ^ image |
|
2355 | 4141 |
! |
4142 |
||
4143 |
superMenu:aSuperMenu |
|
4144 |
"set my supermenu from which i'am activated |
|
4145 |
" |
|
4146 |
superMenu := aSuperMenu. |
|
4147 |
||
2374 | 4148 |
superMenu notNil ifTrue:[ |
2355 | 4149 |
styleSheet := superMenu styleSheet. |
4150 |
rightArrow := superMenu rightArrow. |
|
4151 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4152 |
]. |
|
388 | 4153 |
! ! |
4154 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4155 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4156 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4157 |
activeMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4158 |
"returns the current active menu or self (the top menu) |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4159 |
" |
687 | 4160 |
^ lastActiveMenu ? self |
4161 |
||
798
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:15 / 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 |
activeMenu:aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4166 |
"set the current active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4167 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4168 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4169 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4170 |
"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
|
4171 |
! |
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 |
becomesActiveMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4174 |
"submenu becomes the active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4175 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4176 |
mapTime := Time millisecondClockValue. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4177 |
self topMenu activeMenu:self. |
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 |
"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
|
4180 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4181 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4182 |
clearLastActiveMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4183 |
"reset the current active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4184 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4185 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4186 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4187 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4188 |
|
2251 | 4189 |
"/ prevFocusView notNil ifTrue:[ |
4190 |
"/ self windowGroup focusView:prevFocusView. |
|
4191 |
"/ prevFocusView := nil. |
|
4192 |
"/ ]. |
|
4193 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4194 |
top activeMenu == self ifTrue:[ |
2251 | 4195 |
top activeMenu:nil |
687 | 4196 |
] |
4197 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4198 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4199 |
! |
4200 |
||
4201 |
mapTime |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4202 |
"returns the time when the menu becomes active |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4203 |
" |
687 | 4204 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4205 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4206 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
687 | 4207 |
! ! |
4208 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4209 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 4210 |
|
4211 |
hasScrollerAt:aDirection |
|
4212 |
"returns true if a visible scroller at a direction exists |
|
4213 |
" |
|
4214 |
|layout| |
|
4215 |
||
4216 |
self hasScrollers ifFalse:[ |
|
2219 | 4217 |
^ false |
2016 | 4218 |
]. |
4219 |
||
4220 |
aDirection == #PREV ifTrue:[ |
|
2219 | 4221 |
layout := items first layout. |
2016 | 4222 |
|
4223 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
2219 | 4224 |
ifFalse:[ layout left < margin] |
2016 | 4225 |
]. |
4226 |
layout := items last layout. |
|
4227 |
||
4228 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
2219 | 4229 |
ifFalse:[ layout right > (width - margin)] |
2016 | 4230 |
! |
4231 |
||
4232 |
hasScrollers |
|
4233 |
"returns true if scrollers are needed |
|
4234 |
" |
|
2018 | 4235 |
|maxExtent first last isVert| |
4236 |
||
4237 |
(mustRearrange or:[items size < 2]) ifTrue:[^ false]. |
|
4238 |
||
4239 |
isVert := self verticalLayout. |
|
4240 |
||
4241 |
superView notNil ifTrue:[ |
|
2219 | 4242 |
( (first := items first layout) isNil |
4243 |
or:[(last := items last layout) isNil] |
|
4244 |
) ifTrue:[ |
|
4245 |
^ false |
|
4246 |
]. |
|
4247 |
isVert ifTrue:[ |
|
4248 |
^ first top < 0 or:[last bottom > height] |
|
4249 |
]. |
|
4250 |
^ first left < 0 or:[last right > width] |
|
2018 | 4251 |
]. |
4252 |
maxExtent := self maxExtent. |
|
4253 |
||
4254 |
isVert ifTrue:[ |
|
2219 | 4255 |
^ (height < maxExtent y) not |
2018 | 4256 |
]. |
4257 |
^ (width < maxExtent x) not |
|
2016 | 4258 |
! |
4259 |
||
4260 |
indexOfItemAtScroller:aDirection |
|
4261 |
"returns the index of the item under the scroller or 0 |
|
4262 |
" |
|
4263 |
|bounds min max layout| |
|
4264 |
||
4265 |
bounds := self scrollerBoundsAt:aDirection. |
|
4266 |
||
4267 |
bounds isNil ifTrue:[ |
|
2219 | 4268 |
^ 0 |
2016 | 4269 |
]. |
4270 |
||
4271 |
self verticalLayout ifTrue:[ |
|
2219 | 4272 |
min := bounds top. |
4273 |
max := bounds bottom. |
|
4274 |
||
4275 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4276 |
anItem isVisible ifTrue:[ |
|
4277 |
layout := anItem layout. |
|
4278 |
||
4279 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4280 |
^ anIndex |
|
4281 |
]. |
|
4282 |
]. |
|
4283 |
]. |
|
2016 | 4284 |
] ifFalse:[ |
2219 | 4285 |
min := bounds left. |
4286 |
max := bounds right. |
|
4287 |
||
4288 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4289 |
anItem isVisible ifTrue:[ |
|
4290 |
layout := anItem layout. |
|
4291 |
||
4292 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4293 |
^ anIndex |
|
4294 |
]. |
|
4295 |
]. |
|
4296 |
] |
|
2016 | 4297 |
]. |
4298 |
^ 0 |
|
4299 |
! |
|
4300 |
||
4301 |
makeItemVisible:anItem |
|
4302 |
"make an item visible |
|
4303 |
" |
|
2018 | 4304 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4305 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4306 |
inv1 inv2| |
2018 | 4307 |
|
4308 |
( anItem notNil |
|
4309 |
and:[self hasScrollers |
|
4310 |
and:[(layout := anItem layout) notNil]] |
|
4311 |
) ifFalse:[ |
|
2219 | 4312 |
^ self |
2016 | 4313 |
]. |
2018 | 4314 |
index := self indexOfItem:anItem. |
2016 | 4315 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4316 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4317 |
||
2018 | 4318 |
isVertical := self verticalLayout. |
4319 |
||
4320 |
isVertical ifTrue:[ |
|
2219 | 4321 |
boundsMin := boundsPREV bottom. |
4322 |
boundsMax := boundsNEXT top. |
|
4323 |
layoutMin := layout top. |
|
4324 |
layoutMax := layout bottom. |
|
4325 |
windowSz := height. |
|
2018 | 4326 |
] ifFalse:[ |
2219 | 4327 |
boundsMin := boundsPREV right. |
4328 |
boundsMax := boundsNEXT left. |
|
4329 |
layoutMin := layout left. |
|
4330 |
layoutMax := layout right. |
|
4331 |
windowSz := width. |
|
2018 | 4332 |
]. |
4333 |
||
4334 |
||
4335 |
layoutMin < boundsMin ifTrue:[ |
|
2219 | 4336 |
layoutMin >= 0 ifTrue:[ |
4337 |
^ self |
|
4338 |
]. |
|
4339 |
"/ test whether is first visible item |
|
4340 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
|
4341 |
||
4342 |
index == 0 ifTrue:[ scr0 := margin ] |
|
4343 |
ifFalse:[ scr0 := boundsMin ]. |
|
4344 |
||
4345 |
delta := layoutMin negated + scr0. |
|
2016 | 4346 |
] ifFalse:[ |
2219 | 4347 |
layoutMax > boundsMax ifFalse:[ |
4348 |
^ self |
|
4349 |
]. |
|
4350 |
"/ test whether is last visible item |
|
4351 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
|
4352 |
||
4353 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
|
4354 |
ifFalse:[ scr0 := boundsMax ]. |
|
4355 |
||
4356 |
delta := scr0 - layoutMax. |
|
2018 | 4357 |
]. |
4358 |
delta == 0 ifTrue:[ ^ self ]. |
|
4359 |
||
2016 | 4360 |
doScroll := false. |
4361 |
||
4362 |
shown ifTrue:[ |
|
2219 | 4363 |
delta abs < (windowSz / 2) ifTrue:[ |
4364 |
doScroll := true. |
|
4365 |
self repairDamage |
|
4366 |
] |
|
2016 | 4367 |
]. |
2018 | 4368 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4369 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4370 |
|
4371 |
doScroll ifFalse:[ |
|
2219 | 4372 |
^ self invalidate |
2016 | 4373 |
]. |
4374 |
||
2018 | 4375 |
windowSz := windowSz - margin - margin. |
4376 |
||
4377 |
scr0 := boundsMin. |
|
4378 |
scr1 := scr0 + delta abs. |
|
4379 |
scrSz := boundsMax - scr1. |
|
4380 |
||
4381 |
delta < 0 ifTrue:[ |
|
2219 | 4382 |
isVertical ifTrue:[ |
4383 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
|
4384 |
width:windowSz height:scrSz async:false. |
|
4385 |
||
4386 |
scr1 := scr0 + scrSz. |
|
4387 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
|
4388 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
|
4389 |
] ifFalse:[ |
|
4390 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
|
4391 |
width:scrSz height:windowSz async:false. |
|
4392 |
||
4393 |
scr1 := scr0 + scrSz. |
|
4394 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
|
4395 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
|
4396 |
]. |
|
4397 |
inv1 := boundsPREV. |
|
2016 | 4398 |
] ifFalse:[ |
2219 | 4399 |
isVertical ifTrue:[ |
4400 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
|
4401 |
width:windowSz height:scrSz async:false. |
|
4402 |
||
4403 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
|
4404 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
|
4405 |
] ifFalse:[ |
|
4406 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
|
4407 |
width:scrSz height:windowSz async:false. |
|
4408 |
||
4409 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
|
4410 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
|
4411 |
]. |
|
4412 |
inv1 := boundsNEXT. |
|
2042 | 4413 |
]. |
4414 |
self invalidate:inv1. |
|
4415 |
self invalidate:inv2. |
|
2048 | 4416 |
|
4417 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 4418 |
! |
4419 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4420 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4421 |
"returns the one and only scrollActivity - data holder |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4422 |
for a menu and all contained submenus |
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 |
superMenu notNil ifTrue:[ |
2219 | 4425 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4426 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4427 |
scrollActivity isNil ifTrue:[ |
2219 | 4428 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4429 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4430 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4431 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4432 |
|
2016 | 4433 |
scrollerBoundsAt:aDirection |
4434 |
"returns the bounds of the scroller at a direction or nil |
|
4435 |
" |
|
4436 |
|y x w h inset| |
|
4437 |
||
4438 |
self hasScrollers ifFalse:[ |
|
2219 | 4439 |
^ nil |
2016 | 4440 |
]. |
4441 |
inset := 0. |
|
4442 |
x := y := inset. |
|
4443 |
w := h := 15. |
|
4444 |
||
4445 |
self verticalLayout ifTrue:[ |
|
2219 | 4446 |
aDirection == #NEXT ifTrue:[ |
4447 |
y := height - h - inset. |
|
4448 |
]. |
|
4449 |
w := width - inset - inset. |
|
2016 | 4450 |
] ifFalse:[ |
2219 | 4451 |
aDirection == #NEXT ifTrue:[ |
4452 |
x := width - w - inset. |
|
4453 |
]. |
|
4454 |
h := height - inset - inset. |
|
2016 | 4455 |
]. |
4456 |
^ Rectangle left:x top:y width:w height:h |
|
4457 |
! |
|
4458 |
||
2046 | 4459 |
scrollerDirectionAtPoint:aPoint |
4460 |
"returns the scroller-direction at aPoint, or nil |
|
4461 |
" |
|
4462 |
self hasScrollers ifTrue:[ |
|
2219 | 4463 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
4464 |
( (bounds := self scrollerBoundsAt:aDirection) notNil |
|
4465 |
and:[bounds containsPoint:aPoint] |
|
4466 |
) ifTrue:[ |
|
4467 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
|
4468 |
] |
|
4469 |
] |
|
2046 | 4470 |
]. |
4471 |
^ nil |
|
4472 |
||
4473 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 4474 |
! ! |
4475 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4476 |
!MenuPanel methodsFor:'private-searching'! |
388 | 4477 |
|
1699 | 4478 |
detectGrabMenu |
4479 |
"returns the menu which is responsible for the grap; the last opened menu |
|
4480 |
" |
|
4481 |
|subMenu| |
|
4482 |
||
4483 |
selection notNil ifTrue:[ |
|
2219 | 4484 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
4485 |
^ subMenu detectGrabMenu |
|
4486 |
] |
|
1699 | 4487 |
]. |
4488 |
^ self |
|
4489 |
! |
|
4490 |
||
4491 |
detectMenuAtGrabPoint:aGrabPoint |
|
4492 |
"returns the menu which contains the grab-point |
|
4493 |
" |
|
4494 |
|dstMenu dstPoint firstMenu| |
|
4495 |
||
4496 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
4497 |
||
4498 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
2219 | 4499 |
firstMenu := self. |
1699 | 4500 |
]. |
4501 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4502 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
2219 | 4503 |
^ firstMenu |
1699 | 4504 |
]. |
4505 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 4506 |
^ dstMenu ? firstMenu |
1699 | 4507 |
! |
4508 |
||
1767 | 4509 |
detectViewAtX:x y:y in:aTopView |
1922 | 4510 |
"detect view at x@y |
4511 |
" |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4512 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4513 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4514 |
"/ 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
|
4515 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4516 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4517 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4518 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4519 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4520 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4521 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4522 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4523 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4524 |
"/ 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
|
4525 |
"/ ^ 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
|
4526 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4527 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4528 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4529 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4530 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4531 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4532 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 4533 |
! |
4534 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4535 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4536 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4537 |
If no item match nil is returned. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4538 |
" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4539 |
|idx| |
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 |
stringOrNumberOrPoint isPoint ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4542 |
^ self itemAtPoint:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4543 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4544 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4545 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 4546 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4547 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4548 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4549 |
itemAtPoint:aPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4550 |
"returns the item at aPoint or nil if none detected |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4551 |
" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4552 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4553 |
|
1699 | 4554 |
items notNil ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4555 |
x := aPoint x. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4556 |
y := aPoint y. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4557 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
1699 | 4558 |
]. |
4559 |
^ nil |
|
388 | 4560 |
! |
4561 |
||
2048 | 4562 |
superMenuAtPoint:aPoint |
4563 |
"returns the superMenu which contains aPoint, or nil if none detected |
|
1699 | 4564 |
" |
4565 |
|grabPoint superMenu| |
|
4566 |
||
2048 | 4567 |
(self containsPoint:aPoint) ifTrue:[ |
2219 | 4568 |
^ self |
1699 | 4569 |
]. |
4570 |
||
2048 | 4571 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 4572 |
superMenu := self. |
4573 |
||
4574 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
2219 | 4575 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
4576 |
^ superMenu |
|
4577 |
] |
|
388 | 4578 |
]. |
4579 |
^ nil |
|
1699 | 4580 |
|
2048 | 4581 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 4582 |
! ! |
4583 |
||
4584 |
!MenuPanel methodsFor:'queries'! |
|
4585 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4586 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4587 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4588 |
aView notNil ifTrue:[ |
2219 | 4589 |
"/ I am no longer a popUpView |
4590 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4591 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4592 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4593 |
|
388 | 4594 |
containsPoint:aPoint |
4595 |
"returns true if point is contained by the view |
|
4596 |
" |
|
4597 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
|
4598 |
! |
|
4599 |
||
4600 |
containsPointX:x y:y |
|
4601 |
"returns true if point is contained by the view |
|
4602 |
" |
|
708 | 4603 |
^ (x between:0 and:width) and:[y between:0 and:height] |
879 | 4604 |
|
388 | 4605 |
! |
4606 |
||
390 | 4607 |
hasGroupDividerAt:anIndex |
388 | 4608 |
"returns true if a divider is defined at an index |
4609 |
" |
|
4610 |
|i| |
|
4611 |
||
4612 |
groupSizes size ~~ 0 ifTrue:[ |
|
2219 | 4613 |
i := 0. |
4614 |
||
4615 |
groupSizes do:[:t| |
|
4616 |
(i := i + t) == anIndex ifTrue:[ |
|
4617 |
^ true |
|
4618 |
] |
|
4619 |
] |
|
388 | 4620 |
]. |
4621 |
^ false |
|
4622 |
||
4623 |
! |
|
4624 |
||
390 | 4625 |
hasGroupDividers |
4626 |
"returns true if any group divider exists |
|
4627 |
" |
|
4628 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
4629 |
! |
|
4630 |
||
388 | 4631 |
isEnabled |
4632 |
"returns enabled state of menu and items |
|
4633 |
" |
|
4634 |
^ self enabled |
|
4635 |
! |
|
4636 |
||
390 | 4637 |
isFitPanel |
4638 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 4639 |
be fit to the extent of its superView; |
4640 |
NOT SUPPORTED |
|
4641 |
" |
|
4642 |
^ false |
|
390 | 4643 |
! |
4644 |
||
388 | 4645 |
isPopUpView |
4646 |
"return true if view is a popup view; without decoration |
|
4647 |
and popUp to top immediately |
|
4648 |
" |
|
4649 |
^ superView isNil |
|
4650 |
||
4651 |
||
4652 |
! |
|
4653 |
||
4654 |
isVerticalLayout |
|
4655 |
"returns true if vertical layout otherwise false( horizontal layout ) |
|
4656 |
" |
|
1699 | 4657 |
^ self verticalLayout |
388 | 4658 |
|
4659 |
||
416 | 4660 |
! |
4661 |
||
1793 | 4662 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
4663 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 4664 |
! |
4665 |
||
416 | 4666 |
type |
428 | 4667 |
^ nil. |
416 | 4668 |
|
388 | 4669 |
! ! |
4670 |
||
4671 |
!MenuPanel methodsFor:'selection'! |
|
4672 |
||
4673 |
hasSelection |
|
4674 |
"returns true if a selection exists |
|
4675 |
" |
|
4676 |
^ self selection notNil |
|
4677 |
! |
|
4678 |
||
2199 | 4679 |
openDelayed:anItem |
4680 |
||
2374 | 4681 |
superMenu notNil ifTrue:[ |
2219 | 4682 |
superMenu openDelayed:anItem. |
2374 | 4683 |
^ self |
4684 |
]. |
|
4685 |
openDelayedMenuBlock notNil ifTrue:[ |
|
2253 | 4686 |
Processor removeTimedBlock:openDelayedMenuBlock. |
4687 |
openDelayedMenuBlock := nil. |
|
4688 |
]. |
|
2374 | 4689 |
anItem isNil ifTrue:[ |
2253 | 4690 |
openDelayedMenuBlock := nil. |
2374 | 4691 |
^ self |
2253 | 4692 |
]. |
4693 |
openDelayedMenuBlock := [ |
|
4694 |
openDelayedMenuBlock := nil. |
|
4695 |
anItem openDelayedSubmenu |
|
4696 |
]. |
|
4697 |
||
4698 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:0.5. |
|
2199 | 4699 |
! |
4700 |
||
388 | 4701 |
selection |
4702 |
"returns current selected item or nil |
|
4703 |
" |
|
4704 |
^ selection |
|
4705 |
||
4706 |
||
4707 |
! |
|
4708 |
||
4709 |
selection:anItemOrNil |
|
2016 | 4710 |
"change selection to an item or nil |
2249 | 4711 |
if the item has a submenu the first item might be selected (style-sheet) |
4712 |
" |
|
4713 |
|openMenu openOnSelect submenu item| |
|
4714 |
||
4715 |
selection == anItemOrNil ifTrue:[^ self]. |
|
4716 |
||
4717 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
4718 |
self selection:anItemOrNil openMenu:false. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4719 |
^ self |
2249 | 4720 |
]. |
4721 |
||
4722 |
openMenu := self isPopUpView not. |
|
4723 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
4724 |
||
4725 |
openMenu ifFalse:[ |
|
4726 |
openMenu := openOnSelect. |
|
4727 |
]. |
|
4728 |
self selection:anItemOrNil openMenu:openMenu. |
|
4729 |
||
4730 |
openOnSelect ifFalse:[ |
|
4731 |
"/ select first item in submenu |
|
4732 |
||
4733 |
submenu := anItemOrNil currentSubmenu. |
|
4734 |
||
2374 | 4735 |
submenu notNil ifTrue:[ |
2249 | 4736 |
item := submenu itemAt:1. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4737 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
2249 | 4738 |
submenu selection:item openMenu:false |
4739 |
] |
|
4740 |
]. |
|
4741 |
]. |
|
4742 |
! |
|
4743 |
||
4744 |
selection:anItemOrNil openMenu:openMenu |
|
4745 |
"change selection to an item or nil |
|
4746 |
" |
|
2251 | 4747 |
|helpListener oldSelect| |
2249 | 4748 |
|
4749 |
anItemOrNil == selection ifTrue:[ |
|
4750 |
^ self |
|
2016 | 4751 |
]. |
2199 | 4752 |
self openDelayed:nil. |
388 | 4753 |
|
2251 | 4754 |
oldSelect := selection. |
4755 |
selection := nil. |
|
2249 | 4756 |
|
2374 | 4757 |
anItemOrNil notNil ifTrue:[ |
2249 | 4758 |
self makeItemVisible:anItemOrNil. |
4759 |
anItemOrNil canSelect ifTrue:[ |
|
2251 | 4760 |
selection := anItemOrNil |
2249 | 4761 |
] ifFalse:[ |
2374 | 4762 |
oldSelect isNil ifTrue:[^ self]. |
2249 | 4763 |
]. |
4764 |
]. |
|
2374 | 4765 |
oldSelect notNil ifTrue:[ |
2249 | 4766 |
"/ clear current selection |
2251 | 4767 |
oldSelect isSelected:false. |
4768 |
]. |
|
2374 | 4769 |
selection isNil ifTrue:[^ self]. |
2251 | 4770 |
|
4771 |
selection == enteredItem ifTrue:[ |
|
2249 | 4772 |
enteredItem := nil |
2016 | 4773 |
] ifFalse:[ |
2249 | 4774 |
self pointerEntersItem:nil |
2016 | 4775 |
]. |
4776 |
ActiveHelp isActive ifTrue:[ |
|
2251 | 4777 |
helpListener := ActiveHelp currentHelpListener. |
4778 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 4779 |
]. |
4780 |
shown ifTrue:[ |
|
4781 |
self rearrangeItems. |
|
4782 |
||
4783 |
openMenu ifFalse:[ |
|
4784 |
selection invalidate. |
|
4785 |
] |
|
4786 |
]. |
|
4787 |
openMenu ifTrue:[ |
|
4788 |
selection isSelected:true. |
|
4789 |
]. |
|
388 | 4790 |
! |
4791 |
||
4792 |
selectionIndex |
|
4793 |
"returns index of current selection or 0 |
|
4794 |
" |
|
4795 |
|item| |
|
4796 |
||
4797 |
(item := self selection) notNil ifTrue:[ |
|
2145 | 4798 |
^ self findFirst:[:el| el == item ] |
388 | 4799 |
]. |
4800 |
^ 0 |
|
4801 |
||
4802 |
! |
|
4803 |
||
4804 |
selectionIndex:anIndex |
|
4805 |
"set selection at an index |
|
4806 |
" |
|
4807 |
self selection:(self itemAt:anIndex) |
|
4808 |
! ! |
|
4809 |
||
1791 | 4810 |
!MenuPanel methodsFor:'translation'! |
4811 |
||
4812 |
translateGrabPoint:aGrabPoint |
|
4813 |
"translate the grab point into self |
|
4814 |
" |
|
4815 |
superMenu isNil ifTrue:[ |
|
2219 | 4816 |
"I am the grapView" |
4817 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
1791 | 4818 |
^ aGrabPoint |
4819 |
]. |
|
4820 |
||
4821 |
relativeGrabOrigin isNil ifTrue:[ |
|
2219 | 4822 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
1791 | 4823 |
]. |
4824 |
^ relativeGrabOrigin + aGrabPoint |
|
4825 |
||
4826 |
! |
|
4827 |
||
4828 |
translateMenuPoint:aPoint toMenu:aMenu |
|
4829 |
"translate a point into another menu its point |
|
4830 |
" |
|
4831 |
|grapPoint| |
|
4832 |
||
4833 |
aMenu == self ifTrue:[ |
|
2219 | 4834 |
^ aPoint |
1791 | 4835 |
]. |
4836 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
4837 |
||
4838 |
^ aMenu translateGrabPoint:grapPoint |
|
4839 |
||
4840 |
! |
|
4841 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4842 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4843 |
"translate a point in my window to anotherWindowOrNilForScreen (or root window if nil) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4844 |
" |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4845 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4846 |
^ device |
2219 | 4847 |
translatePoint:aPoint asPoint |
4848 |
fromView:self |
|
4849 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4850 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4851 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 4852 |
! ! |
4853 |
||
388 | 4854 |
!MenuPanel::Item class methodsFor:'accessing'! |
4855 |
||
689 | 4856 |
horizontalInset |
4857 |
^ HorizontalInset |
|
4858 |
! |
|
4859 |
||
388 | 4860 |
labelRightOffset |
4861 |
^ LabelRightOffset |
|
4862 |
! |
|
4863 |
||
689 | 4864 |
verticalInset |
4865 |
^ VerticalInset |
|
1765 | 4866 |
! |
4867 |
||
4868 |
verticalPopUpInset |
|
4869 |
^ VerticalPopUpInset |
|
388 | 4870 |
! ! |
4871 |
||
616 | 4872 |
!MenuPanel::Item class methodsFor:'defaults'! |
4873 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4874 |
halfSeparatorSize |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4875 |
"returns size of a space-separator |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4876 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4877 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4878 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4879 |
|
1699 | 4880 |
separatorSize |
616 | 4881 |
"returns size of a separator |
4882 |
" |
|
1699 | 4883 |
^ 10 |
616 | 4884 |
! |
4885 |
||
4886 |
updateStyleCache |
|
388 | 4887 |
"setup defaults |
650 | 4888 |
self updateStyleCache |
388 | 4889 |
" |
1765 | 4890 |
<resource: #style (#'menuPanel.verticalInset')> |
4891 |
||
1699 | 4892 |
HorizontalInset := 2. |
1765 | 4893 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
4894 |
VerticalPopUpInset := 2. |
|
727 | 4895 |
|
4896 |
HorizontalButtonInset := 3. |
|
4897 |
VerticalButtonInset := 3. |
|
4898 |
||
681 | 4899 |
LabelRightOffset := 15. |
1765 | 4900 |
|
4901 |
||
1124 | 4902 |
! ! |
1078 | 4903 |
|
388 | 4904 |
!MenuPanel::Item class methodsFor:'instance creation'! |
4905 |
||
4906 |
in:aSuperMenu |
|
4907 |
^ self in:aSuperMenu label:nil |
|
4908 |
! |
|
4909 |
||
4910 |
in:aSuperMenu label:aLabel |
|
4911 |
|item| |
|
4912 |
||
4913 |
item := self new in:aSuperMenu. |
|
4914 |
item label:aLabel. |
|
4915 |
^ item |
|
4916 |
! |
|
4917 |
||
4918 |
in:aSuperMenu menuItem:aMenuItem |
|
4919 |
|item| |
|
4920 |
||
4921 |
item := self in:aSuperMenu. |
|
4922 |
item menuItem:aMenuItem. |
|
4923 |
^ item. |
|
2359 | 4924 |
! |
4925 |
||
4926 |
new |
|
4927 |
^ self basicNew initialize |
|
388 | 4928 |
! ! |
4929 |
||
1808 | 4930 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 4931 |
|
420 | 4932 |
canAccept |
4933 |
"returns true if item is acceptable |
|
4934 |
" |
|
2199 | 4935 |
self enabled ifFalse:[ ^ false]. |
4936 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
4937 |
||
4938 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
4939 |
^ subMenu isNil or:[subMenu shown not] |
|
524 | 4940 |
! |
4941 |
||
4942 |
toggleIndication |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4943 |
"toggle indication or choice |
524 | 4944 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4945 |
|arg| |
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 |
indication notNil ifTrue:[ |
2359 | 4948 |
arg := self indicationValue not. |
4949 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4950 |
] ifFalse:[ |
2359 | 4951 |
choice notNil ifTrue:[ |
4952 |
choice value:(menuItem choiceValue). |
|
4953 |
^ true |
|
4954 |
] |
|
524 | 4955 |
]. |
4956 |
^ arg |
|
389 | 4957 |
! ! |
4958 |
||
388 | 4959 |
!MenuPanel::Item methodsFor:'accessing'! |
4960 |
||
4961 |
accessCharacter |
|
389 | 4962 |
"returns my accessCharacter or nil |
388 | 4963 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4964 |
^ accessCharacter |
388 | 4965 |
! |
4966 |
||
4967 |
accessCharacterPosition |
|
390 | 4968 |
"get the access character position or nil |
388 | 4969 |
" |
2359 | 4970 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4971 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4972 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4973 |
accessCharacterPosition:anIndex |
390 | 4974 |
"set the access character position or nil |
388 | 4975 |
" |
2359 | 4976 |
menuItem accessCharacterPosition:anIndex. |
388 | 4977 |
! |
4978 |
||
4979 |
argument |
|
4980 |
"gets the argument |
|
4981 |
" |
|
2359 | 4982 |
^ menuItem argument |
388 | 4983 |
! |
4984 |
||
4985 |
argument:anArgument |
|
4986 |
"sets the argument |
|
4987 |
" |
|
2359 | 4988 |
menuItem argument:anArgument. |
389 | 4989 |
! |
4990 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4991 |
displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4992 |
"returns my printable Label |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4993 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4994 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4995 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4996 |
|
2614 | 4997 |
displayLabelExtent |
4998 |
"returns the labelExtent |
|
4999 |
" |
|
5000 |
|prevFont w h| |
|
5001 |
||
5002 |
displayLabelExtent notNil ifTrue:[ |
|
5003 |
^ displayLabelExtent |
|
5004 |
]. |
|
5005 |
||
5006 |
displayLabel isNil ifTrue:[ |
|
5007 |
displayLabelExtent := 0@0. |
|
5008 |
^ displayLabelExtent |
|
5009 |
]. |
|
5010 |
prevFont := menuPanel setFont:(self font). |
|
5011 |
||
5012 |
displayLabel isArray ifTrue:[ |
|
5013 |
w := h := 0. |
|
5014 |
||
5015 |
displayLabel do:[:aSubLabel| |
|
5016 |
aSubLabel notNil ifTrue:[ |
|
5017 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
5018 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
5019 |
] ifFalse:[ |
|
5020 |
h := h + (self spaceBetweenEmptyLines) |
|
5021 |
] |
|
5022 |
] |
|
5023 |
] ifFalse:[ |
|
5024 |
w := displayLabel widthOn:menuPanel. |
|
5025 |
h := displayLabel heightOn:menuPanel. |
|
5026 |
]. |
|
5027 |
"/ care for italic fonts - give a few more pixels at the end |
|
5028 |
menuPanel font italic ifTrue:[ |
|
5029 |
w := w + 2. |
|
5030 |
]. |
|
5031 |
displayLabelExtent := w@h. |
|
5032 |
||
5033 |
prevFont notNil ifTrue:[ |
|
5034 |
menuPanel setFont:prevFont. "/ restore previous font |
|
5035 |
]. |
|
5036 |
^ displayLabelExtent |
|
5037 |
! |
|
5038 |
||
1727 | 5039 |
font |
5040 |
"returns the user configured font or nil (default menu font) |
|
5041 |
" |
|
2373 | 5042 |
|font| |
5043 |
||
5044 |
menuPanel isNil ifTrue:[^ nil]. |
|
5045 |
||
5046 |
font := menuItem font. |
|
5047 |
||
5048 |
font notNil ifTrue:[ |
|
5049 |
font := font onDevice:(menuPanel device). |
|
5050 |
menuItem font:font. |
|
5051 |
]. |
|
1727 | 5052 |
^ font |
5053 |
! |
|
5054 |
||
5055 |
font:aFont |
|
5056 |
"returns the user configured font or nil (default menu font) |
|
5057 |
" |
|
2373 | 5058 |
menuItem font:aFont. |
1727 | 5059 |
! |
5060 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5061 |
ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5062 |
"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
|
5063 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5064 |
^ menuItem ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5065 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5066 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5067 |
ignoreMnemonicKeys:aBoolean |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5068 |
"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
|
5069 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5070 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5071 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5072 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5073 |
ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5074 |
"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
|
5075 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5076 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5077 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5078 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5079 |
ignoreShortcutKeys:aBoolean |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5080 |
"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
|
5081 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5082 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5083 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5084 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5085 |
itemValue |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5086 |
"gets value |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5087 |
" |
2360 | 5088 |
^ menuItem itemValue |
5089 |
! |
|
5090 |
||
5091 |
itemValue:aValue |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5092 |
"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
|
5093 |
" |
2360 | 5094 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5095 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5096 |
|
388 | 5097 |
label |
5098 |
"returns the label |
|
5099 |
" |
|
5100 |
^ label |
|
5101 |
! |
|
5102 |
||
5103 |
label:aLabel |
|
399 | 5104 |
"set a new label; if the label changed, a redraw is performed; |
5105 |
handle characters $& (ST-80 compatibility) |
|
388 | 5106 |
" |
2614 | 5107 |
|size char oldExtent| |
5108 |
||
5109 |
oldExtent := displayLabelExtent. |
|
5110 |
displayLabelExtent := nil. "/ force a recomputation |
|
5111 |
accessCharacter := disabledDisplayLabel := nil. |
|
5112 |
label := aLabel value. |
|
5113 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5114 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5115 |
displayLabel isString ifTrue:[ |
2359 | 5116 |
"CHECK FOR SEPARATOR" |
5117 |
||
5118 |
(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
|
5119 |
size := displayLabel size. |
2359 | 5120 |
|
5121 |
size == 0 ifTrue:[ |
|
2614 | 5122 |
displayLabel := nil. "blank separator" |
2359 | 5123 |
^ self |
5124 |
]. |
|
5125 |
||
5126 |
size == 1 ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5127 |
char := displayLabel first. |
2359 | 5128 |
|
5129 |
(char == $- or:[char == $=]) ifTrue:[ |
|
2614 | 5130 |
label := displayLabel. "line separator" |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5131 |
displayLabel := nil. |
2359 | 5132 |
^ self |
5133 |
] |
|
5134 |
] |
|
5135 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5136 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5137 |
displayLabel isCollection ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5138 |
displayLabel := displayLabel asArray. |
2359 | 5139 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5140 |
]. |
2614 | 5141 |
displayLabel notNil ifTrue:[ |
5142 |
displayLabel isArray ifTrue:[ |
|
5143 |
displayLabel keysAndValuesDo:[:i :el| |
|
5144 |
el notNil ifTrue:[ |
|
5145 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
|
5146 |
]. |
|
5147 |
]. |
|
5148 |
] ifFalse:[ |
|
5149 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
|
5150 |
]. |
|
5151 |
]. |
|
5152 |
||
5153 |
menuPanel shown ifTrue:[ |
|
5154 |
self fetchImages. |
|
5155 |
||
5156 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
5157 |
self invalidate |
|
5158 |
] ifFalse:[ |
|
5159 |
menuPanel mustRearrange |
|
2359 | 5160 |
] |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5161 |
]. |
388 | 5162 |
! |
5163 |
||
5164 |
menuPanel |
|
5165 |
"returns my menuPanel |
|
5166 |
" |
|
399 | 5167 |
^ menuPanel |
388 | 5168 |
! |
5169 |
||
5170 |
nameKey |
|
5171 |
"gets the nameKey |
|
5172 |
" |
|
2359 | 5173 |
^ menuItem nameKey |
388 | 5174 |
! |
5175 |
||
5176 |
nameKey:aNameKey |
|
5177 |
"sets the nameKey |
|
5178 |
" |
|
2359 | 5179 |
menuItem nameKey:aNameKey. |
388 | 5180 |
! |
5181 |
||
5182 |
rawLabel |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5183 |
"returns my raw, unprocessed label |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5184 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5185 |
^ menuItem rawLabel |
388 | 5186 |
! |
5187 |
||
5188 |
shortcutKey |
|
5189 |
"get the key to press to select the submenu from the keyboard or if |
|
5190 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5191 |
" |
|
2359 | 5192 |
^ menuItem shortcutKey |
388 | 5193 |
! |
5194 |
||
5195 |
shortcutKey:aKey |
|
5196 |
"set the key to press to select the submenu from the keyboard or if |
|
5197 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5198 |
" |
|
2359 | 5199 |
menuItem shortcutKey ~= aKey ifTrue:[ |
5200 |
menuItem shortcutKey:aKey. |
|
5201 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5202 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5203 |
! |
388 | 5204 |
|
710 | 5205 |
startGroup |
5206 |
"start group #left #right #center ... or nil |
|
5207 |
at the moment only #right is implemented |
|
5208 |
" |
|
2359 | 5209 |
^ menuItem startGroup |
710 | 5210 |
! |
5211 |
||
5212 |
startGroup:aSymbol |
|
5213 |
"start group #left #right #center ... |
|
5214 |
at the moment only #right is implemented |
|
5215 |
" |
|
2359 | 5216 |
menuItem startGroup:aSymbol. |
710 | 5217 |
! |
5218 |
||
388 | 5219 |
submenu |
5220 |
"returns my submenu or nil |
|
5221 |
" |
|
464 | 5222 |
subMenu notNil ifTrue:[^ subMenu]. |
5223 |
^ self setupSubmenu |
|
388 | 5224 |
! |
5225 |
||
5226 |
submenu:aSubMenu |
|
5227 |
"set a new submenu; an existing submenu will be destroyed. This might lead |
|
5228 |
to a redraw if 'hasSubmenu' changed |
|
5229 |
" |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5230 |
|widget| |
1767 | 5231 |
|
5232 |
aSubMenu isNil ifTrue:[ |
|
2360 | 5233 |
subMenu notNil ifTrue:[ |
5234 |
subMenu destroy. |
|
5235 |
subMenu := nil. |
|
5236 |
]. |
|
5237 |
^ self |
|
1767 | 5238 |
]. |
5239 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5240 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
2360 | 5241 |
subMenu := MenuPanel new. |
5242 |
||
5243 |
menuPanel notNil ifTrue:[ |
|
5244 |
subMenu receiver:menuPanel receiver. |
|
5245 |
]. |
|
5246 |
subMenu superMenu:menuPanel. |
|
5247 |
||
5248 |
menuItem horizontalLayout == true ifTrue:[ |
|
5249 |
subMenu verticalLayout:false |
|
5250 |
]. |
|
5251 |
subMenu menu:aSubMenu. |
|
1767 | 5252 |
] ifFalse:[ |
2360 | 5253 |
aSubMenu isView ifFalse:[ |
5254 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
5255 |
"/ ... mhhhh .... |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5256 |
^ menuItem submenuChannel:aSubMenu |
2360 | 5257 |
]. |
5258 |
widget := SimpleView new. |
|
5259 |
widget client:aSubMenu. |
|
5260 |
] ifTrue:[ |
|
5261 |
widget := aSubMenu |
|
5262 |
]. |
|
5263 |
||
5264 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
5265 |
subMenu := widget. |
|
5266 |
||
5267 |
menuItem horizontalLayout == true ifTrue:[ |
|
5268 |
subMenu verticalLayout:false |
|
5269 |
]. |
|
5270 |
] ifFalse:[ |
|
5271 |
subMenu := MenuPanel new. |
|
5272 |
subMenu receiver:menuPanel receiver. |
|
5273 |
subMenu addSubView:widget. |
|
5274 |
subMenu extent:(widget preferredExtent). |
|
5275 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
5276 |
]. |
|
5277 |
subMenu superMenu:menuPanel. |
|
5278 |
]. |
|
389 | 5279 |
! |
5280 |
||
390 | 5281 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5282 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5283 |
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
|
5284 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5285 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5286 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5287 |
displayLabel notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5288 |
displayLabel isArray ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5289 |
^ displayLabel perform:#string ifNotUnderstood:nil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5290 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5291 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5292 |
displayLabel do:[:el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5293 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5294 |
^ txt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5295 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5296 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5297 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5298 |
^ nil |
390 | 5299 |
! |
5300 |
||
1841 | 5301 |
triggerOnDown |
5302 |
"trigger the action if pressed |
|
5303 |
" |
|
2359 | 5304 |
menuItem triggerOnDown ifTrue:[ |
5305 |
self hasSubmenu ifFalse:[^ true]. |
|
1841 | 5306 |
]. |
5307 |
^ false |
|
5308 |
! |
|
5309 |
||
5310 |
triggerOnDown:aBool |
|
5311 |
"trigger the action if pressed |
|
5312 |
" |
|
2359 | 5313 |
menuItem triggerOnDown:aBool. |
1841 | 5314 |
! |
5315 |
||
389 | 5316 |
value |
5317 |
"gets value |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5318 |
Left here for ST80 compatibility - value is a bad name |
389 | 5319 |
" |
2360 | 5320 |
^ menuItem itemValue |
5321 |
! |
|
5322 |
||
5323 |
value:aValue |
|
389 | 5324 |
"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
|
5325 |
Left here for ST80 compatibility - value: is a bad name |
389 | 5326 |
" |
2360 | 5327 |
menuItem itemValue:aValue. |
502 | 5328 |
! |
5329 |
||
5330 |
value:aValue argument:anArgument |
|
5331 |
"set the value and an argument |
|
5332 |
" |
|
2360 | 5333 |
menuItem itemValue:aValue. |
5334 |
menuItem argument:anArgument. |
|
388 | 5335 |
! ! |
5336 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5337 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5338 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5339 |
choice |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5340 |
"implements a radio group; the field |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5341 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5342 |
^ choice |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5343 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5344 |
! |
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 |
choice:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5347 |
"set choice indication |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5348 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5349 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5350 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5351 |
choice isValueModel ifTrue:[ |
2219 | 5352 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5353 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5354 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5355 |
(choice := something) notNil ifTrue:[ |
2219 | 5356 |
choice isSymbol ifTrue:[ |
5357 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
5358 |
choice := something |
|
5359 |
] |
|
5360 |
]. |
|
5361 |
choice isValueModel ifTrue:[ |
|
5362 |
choice addDependent:self |
|
5363 |
] |
|
1699 | 5364 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5365 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5366 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5367 |
choiceValue |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5368 |
"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
|
5369 |
" |
2359 | 5370 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5371 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5372 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5373 |
choiceValue:something |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5374 |
"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
|
5375 |
" |
2359 | 5376 |
menuItem choiceValue ~= something ifTrue:[ |
5377 |
menuItem choiceValue:something. |
|
5378 |
choice notNil ifTrue:[ self invalidate ]. |
|
5379 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5380 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5381 |
|
388 | 5382 |
enabled |
5383 |
"returns the enabled state |
|
5384 |
" |
|
524 | 5385 |
|state| |
5386 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5387 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5388 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5389 |
enableChannel isSymbol ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5390 |
state := self aspectAt:enableChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5391 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5392 |
state isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5393 |
self ifNotInUIBuilderInfoPrintCR: |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5394 |
('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')'). |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5395 |
^ true |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5396 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5397 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5398 |
state isValueModel ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5399 |
enableChannel := state. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5400 |
enableChannel addDependent:self. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5401 |
state := enableChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5402 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5403 |
state := state value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5404 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5405 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5406 |
state := enableChannel value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5407 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5408 |
^ state ~~ false |
388 | 5409 |
! |
5410 |
||
389 | 5411 |
enabled:something |
388 | 5412 |
"change the enabled state; if the state changed, a redraw is performed |
5413 |
" |
|
390 | 5414 |
|oldState newState| |
5415 |
||
5416 |
enableChannel isNil ifTrue:[ |
|
2219 | 5417 |
oldState := true |
390 | 5418 |
] ifFalse:[ |
2219 | 5419 |
oldState := enableChannel value. |
5420 |
enableChannel isValueModel ifTrue:[ |
|
5421 |
enableChannel removeDependent:self |
|
5422 |
] |
|
388 | 5423 |
]. |
390 | 5424 |
enableChannel := something. |
5425 |
||
5426 |
enableChannel isNil ifTrue:[ |
|
2219 | 5427 |
menuPanel shown ifFalse:[^ self]. |
5428 |
newState := true |
|
390 | 5429 |
] ifFalse:[ |
2219 | 5430 |
enableChannel isValueModel ifTrue:[ |
5431 |
enableChannel addDependent:self |
|
5432 |
] ifFalse:[ |
|
5433 |
enableChannel isSymbol ifTrue:[^ self] |
|
5434 |
]. |
|
5435 |
menuPanel shown ifFalse:[^ self]. |
|
5436 |
newState := enableChannel value. |
|
390 | 5437 |
]. |
5438 |
||
5439 |
newState ~~ oldState ifTrue:[ |
|
2219 | 5440 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5441 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5442 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5443 |
|
1670 | 5444 |
hideMenuOnActivated |
5445 |
"hide the menu when the item was activated; the default is true |
|
5446 |
" |
|
2359 | 5447 |
^ menuItem hideMenuOnActivated |
1670 | 5448 |
! |
5449 |
||
5450 |
hideMenuOnActivated:aBool |
|
5451 |
"hide the menu when the item was activated; the default is true |
|
5452 |
" |
|
2359 | 5453 |
menuItem hideMenuOnActivated:aBool. |
1670 | 5454 |
! |
5455 |
||
2216 | 5456 |
ifNotInUIBuilderInfoPrintCR:aMessage |
5457 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
5458 |
||
5459 |
(menuPanel receiver isNil |
|
5460 |
and:[ menuPanel application notNil |
|
5461 |
and:[ menuPanel application askFor:#isUIPainter]]) |
|
5462 |
ifTrue:[ |
|
2219 | 5463 |
^ self "/ suppressed |
2216 | 5464 |
]. |
5465 |
aMessage infoPrintCR |
|
5466 |
! |
|
5467 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5468 |
indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5469 |
"get on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5470 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5471 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5472 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5473 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5474 |
indication:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5475 |
"set on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5476 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5477 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5478 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5479 |
indication isValueModel ifTrue:[ |
2219 | 5480 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5481 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5482 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5483 |
(indication := something) notNil ifTrue:[ |
2219 | 5484 |
indication isValueModel ifTrue:[ |
5485 |
indication addDependent:self |
|
5486 |
] ifFalse:[ |
|
5487 |
"/ to force an update of the value |
|
5488 |
self indicationValue |
|
5489 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5490 |
]. |
464 | 5491 |
! |
5492 |
||
1767 | 5493 |
keepLinkedMenu |
5494 |
"get the keepLinkedMenu flag |
|
5495 |
" |
|
2359 | 5496 |
^ menuItem keepLinkedMenu |
5497 |
! |
|
5498 |
||
5499 |
keepLinkedMenu:aBool |
|
1767 | 5500 |
"get the keepLinkedMenu flag |
5501 |
" |
|
2359 | 5502 |
menuItem keepLinkedMenu:aBool. |
1767 | 5503 |
! |
5504 |
||
2331 | 5505 |
sendToOriginator |
5506 |
"if true, the message is sent to the originating widget; |
|
5507 |
otherwise (the default), it it sent to the receiver/application." |
|
5508 |
||
2359 | 5509 |
^ menuItem sendToOriginator |
2331 | 5510 |
! |
5511 |
||
5512 |
sendToOriginator:aBoolean |
|
5513 |
"if true, the message is sent to the originating widget; |
|
5514 |
otherwise (the default), it it sent to the receiver/application." |
|
5515 |
||
2359 | 5516 |
menuItem sendToOriginator:aBoolean. |
2331 | 5517 |
! |
5518 |
||
464 | 5519 |
submenuChannel |
5520 |
"get the submenu channel |
|
5521 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5522 |
^ menuItem submenuChannel |
464 | 5523 |
! |
5524 |
||
5525 |
submenuChannel:aSelectorOrNil |
|
5526 |
"returns the submenu channel |
|
5527 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5528 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 5529 |
! ! |
5530 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5531 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 5532 |
|
2016 | 5533 |
moveBy:aPoint |
5534 |
"move layout origin |
|
5535 |
" |
|
5536 |
layout moveBy:aPoint. |
|
5537 |
! |
|
5538 |
||
1699 | 5539 |
preferredExtent |
5540 |
"compute my preferred extent excluding the shortCutKey and the menu identifier |
|
5541 |
" |
|
2614 | 5542 |
|isVertical icon wIcon isButton labelExtent |
1699 | 5543 |
x "{ Class:SmallInteger }" |
5544 |
y "{ Class:SmallInteger }" |
|
5545 |
s "{ Class:SmallInteger }" |
|
5546 |
| |
|
5547 |
self isVisible ifFalse:[^ 0@0 ]. |
|
5548 |
||
2359 | 5549 |
isButton := menuItem isButton. |
5550 |
||
1699 | 5551 |
isButton ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5552 |
s := menuPanel maxAbsoluteButtonLevel. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5553 |
x := s + HorizontalButtonInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5554 |
y := s + VerticalButtonInset. |
1699 | 5555 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5556 |
x := HorizontalInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5557 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 5558 |
]. |
5559 |
x := x * 2. |
|
5560 |
y := y * 2. |
|
5561 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5562 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5563 |
|
2362 | 5564 |
self isSeparator ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5565 |
"SEPARATOR" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5566 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5567 |
s := self class separatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5568 |
label = '' ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5569 |
s := self class halfSeparatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5570 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5571 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5572 |
"width of doubleSeparator is 5 !!!!" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5573 |
isVertical ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5574 |
x := x max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5575 |
y := y + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5576 |
] ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5577 |
y := y max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5578 |
x := x + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5579 |
]. |
1699 | 5580 |
] ifFalse:[ |
2614 | 5581 |
labelExtent := self displayLabelExtent. |
5582 |
||
5583 |
x := x + labelExtent x. |
|
5584 |
y := y + labelExtent y. |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5585 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5586 |
isButton ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5587 |
menuPanel showSeparatingLines ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5588 |
"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
|
5589 |
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
|
5590 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5591 |
(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
|
5592 |
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
|
5593 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5594 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5595 |
wIcon := 0. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5596 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5597 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5598 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5599 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5600 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5601 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5602 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5603 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5604 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5605 |
x := x + wIcon. |
1699 | 5606 |
]. |
5607 |
^ x@y |
|
388 | 5608 |
! ! |
5609 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5610 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 5611 |
|
5612 |
activeHelpKey |
|
5613 |
"get the active helpKey; the key to retrieve the helpText from the application |
|
5614 |
" |
|
2359 | 5615 |
^ menuItem activeHelpKey |
1613 | 5616 |
! |
5617 |
||
5618 |
activeHelpKey:aHelpKey |
|
5619 |
"set the active helpKey; the key to retrieve the helpText from the application |
|
5620 |
" |
|
2359 | 5621 |
menuItem activeHelpKey:aHelpKey. |
5622 |
activeHelpText := nil. |
|
1613 | 5623 |
! |
5624 |
||
5625 |
activeHelpText |
|
5626 |
"get the active helpText or nil if not yet resolved |
|
5627 |
" |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5628 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5629 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5630 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5631 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5632 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5633 |
((key := self activeHelpKey) notNil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5634 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5635 |
^ app helpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5636 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5637 |
^ nil |
1613 | 5638 |
! |
5639 |
||
5640 |
activeHelpText:aText |
|
5641 |
"set the active helpText |
|
5642 |
" |
|
5643 |
activeHelpText := aText. |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5644 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5645 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5646 |
flyByHelpText |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5647 |
"get the flyBy helpText or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5648 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5649 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5650 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5651 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5652 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5653 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
5654 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
5655 |
|
2471 | 5656 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
5657 |
"/ (if you have an argument for that let us know..) |
|
5658 |
"/ self isButton ifFalse:[^ nil]. |
|
5659 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5660 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5661 |
key := self activeHelpKey. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5662 |
(key notNil and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5663 |
text := app flyByHelpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5664 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5665 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5666 |
text isNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5667 |
text := key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5668 |
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
|
5669 |
displayLabel isString ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5670 |
text := displayLabel string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5671 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5672 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5673 |
text isNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5674 |
text := self rawLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5675 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5676 |
text := menuItem rawLabel. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5677 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5678 |
text := nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5679 |
] |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5680 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5681 |
text notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5682 |
(text includes:$&) ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5683 |
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
|
5684 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5685 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5686 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5687 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5688 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5689 |
text = displayLabel ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5690 |
"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
|
5691 |
(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
|
5692 |
^ nil |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5693 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5694 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5695 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5696 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5697 |
flyByHelpText:aText |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5698 |
"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
|
5699 |
" |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5700 |
flyByHelpText := aText. |
1613 | 5701 |
! ! |
5702 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5703 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5704 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5705 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5706 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5707 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5708 |
" |
2360 | 5709 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5710 |
! |
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 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5713 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5714 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5715 |
" |
2360 | 5716 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5717 |
! |
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 |
isButton |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5720 |
"returns whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5721 |
" |
2359 | 5722 |
^ menuItem isButton |
5723 |
! |
|
5724 |
||
5725 |
isButton:aBool |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5726 |
"sets whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5727 |
" |
2359 | 5728 |
menuItem isButton ~~ aBool ifTrue:[ |
5729 |
menuItem isButton:aBool. |
|
5730 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5731 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5732 |
! |
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 |
layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5735 |
"returns my layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5736 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5737 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5738 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5739 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5740 |
layout:aLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5741 |
"set a new layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5742 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5743 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5744 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5745 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5746 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5747 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5748 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5749 |
"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
|
5750 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5751 |
" |
2359 | 5752 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5753 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5754 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5755 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5756 |
"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
|
5757 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5758 |
" |
2359 | 5759 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5760 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5761 |
|
2504 | 5762 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 5763 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5764 |
currentSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5765 |
"returns the current submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5766 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5767 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5768 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5769 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5770 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5771 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5772 |
|
1705 | 5773 |
hideSubmenu |
5774 |
"hide submenu |
|
5775 |
" |
|
2199 | 5776 |
self hideSubmenu:subMenu. |
5777 |
! |
|
5778 |
||
5779 |
hideSubmenu:aSubmenu |
|
5780 |
"hide submenu |
|
5781 |
" |
|
1705 | 5782 |
|id| |
5783 |
||
2374 | 5784 |
aSubmenu isNil ifTrue:[^ self]. |
2199 | 5785 |
|
5786 |
aSubmenu realized ifFalse:[ |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5787 |
id := aSubmenu id. |
2374 | 5788 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
2199 | 5789 |
] ifTrue:[ |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5790 |
aSubmenu hide |
2199 | 5791 |
]. |
5792 |
||
5793 |
aSubmenu windowGroup:nil. |
|
5794 |
menuPanel windowGroup removeView:aSubmenu. |
|
5795 |
||
5796 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5797 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5798 |
menuItem keepLinkedMenu ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5799 |
subMenu := nil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5800 |
] |
2199 | 5801 |
]. |
5802 |
! |
|
5803 |
||
5804 |
openDelayedSubmenu |
|
5805 |
"called to open now my delayed submenu |
|
5806 |
" |
|
5807 |
|subm| |
|
5808 |
||
5809 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
5810 |
||
2374 | 5811 |
subMenu notNil ifTrue:[ |
5812 |
subMenu realized ifTrue:[ |
|
5813 |
"/ already open |
|
5814 |
^ self |
|
5815 |
]. |
|
2199 | 5816 |
]. |
5817 |
subm := self setupSubmenu. |
|
2374 | 5818 |
subm isNil ifTrue:[^ self]. |
2199 | 5819 |
|
5820 |
self openSubmenu. |
|
5821 |
||
5822 |
(subm == subMenu and:[self isSelected]) ifFalse:[ |
|
2374 | 5823 |
"/ closed during building or opening the submenu |
5824 |
self hideSubmenu:subm. |
|
2199 | 5825 |
]. |
1705 | 5826 |
! |
1701 | 5827 |
|
5828 |
openSubmenu |
|
5829 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
5830 |
is fully visible by shifting it into the visible screen area if |
|
5831 |
nescessary. |
|
5832 |
" |
|
2249 | 5833 |
|p o device isVertical topMenu windGrp prefExtent |
1701 | 5834 |
devBot "{ Class:SmallInteger }" |
5835 |
devRight "{ Class:SmallInteger }" |
|
5836 |
width "{ Class:SmallInteger }" |
|
5837 |
height "{ Class:SmallInteger }" |
|
5838 |
top "{ Class:SmallInteger }" |
|
5839 |
left "{ Class:SmallInteger }" |
|
5840 |
| |
|
5841 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
5842 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
2249 | 5843 |
^ self |
1701 | 5844 |
]. |
5845 |
||
5846 |
topMenu := menuPanel topMenu. |
|
1829 | 5847 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
2249 | 5848 |
subMenu releaseDeviceResources. |
5849 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
5850 |
subMenu recreate. |
|
1829 | 5851 |
]. |
5852 |
||
1701 | 5853 |
windGrp := topMenu windowGroup. |
5854 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5855 |
subMenu superMenu:menuPanel. |
1701 | 5856 |
subMenu becomesActiveMenu. |
5857 |
subMenu cursor:Cursor hand. |
|
5858 |
||
5859 |
windGrp notNil ifTrue:[ |
|
2249 | 5860 |
subMenu windowGroup:windGrp. |
5861 |
windGrp addTopView:subMenu. |
|
1701 | 5862 |
]. |
5863 |
||
2111 | 5864 |
"Q&D kludge - test whether the layout is nil; |
2249 | 5865 |
if true recompute the layouts |
2111 | 5866 |
" |
2374 | 5867 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 5868 |
|
1701 | 5869 |
" Q&D kludge - if any visibility attributes are blocks; |
5870 |
TODO: only invoke mustRearrange if any are blocks |
|
2249 | 5871 |
(since I react correctly on valueHolder changes) |
1701 | 5872 |
" |
5873 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
5874 |
subMenu fixSize. |
|
5875 |
||
5876 |
"compute origin of subMenu |
|
5877 |
" |
|
5878 |
isVertical := menuPanel verticalLayout. |
|
5879 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5880 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5881 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5882 |
width := prefExtent x. |
1701 | 5883 |
devBot := device usableHeight. |
5884 |
devRight := device usableWidth. |
|
5885 |
||
5886 |
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
|
5887 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5888 |
menuPanel isPopUpView ifTrue:[ |
2249 | 5889 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5890 |
] ifFalse:[ |
2249 | 5891 |
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
|
5892 |
]. |
1701 | 5893 |
left := o x. |
5894 |
top := o y. |
|
5895 |
||
2016 | 5896 |
top + height > devBot ifTrue:[ |
2249 | 5897 |
top := isVertical ifTrue:[devBot - height] |
5898 |
ifFalse:[top - layout height - height + 2] |
|
2016 | 5899 |
]. |
5900 |
top := top max:0. |
|
5901 |
||
5902 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
5903 |
"/ top < menuPanel bottom ifTrue:[ |
|
5904 |
"/ left := left + layout width. |
|
5905 |
"/ ]. |
|
5906 |
"/ left + width > devRight ifTrue:[ |
|
5907 |
"/ left := o x - width - 2 |
|
5908 |
"/ ]. |
|
5909 |
"/ ]. |
|
5910 |
||
1701 | 5911 |
left + width > devRight ifTrue:[ |
2249 | 5912 |
left := isVertical ifTrue:[left - layout width - width + 2] |
5913 |
ifFalse:[devRight - width] |
|
1701 | 5914 |
]. |
5915 |
left := left max:0. |
|
5916 |
||
5917 |
subMenu origin:(left@top). |
|
5918 |
||
5919 |
subMenu realized ifFalse:[ |
|
2249 | 5920 |
subMenu realize. |
1701 | 5921 |
] ifTrue:[ |
2249 | 5922 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5923 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5924 |
! |
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 |
toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5927 |
"toggle the visibility of the submenu |
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 |
subMenu notNil ifTrue:[ |
2219 | 5930 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5931 |
] ifFalse:[ |
2219 | 5932 |
(subMenu := self setupSubmenu) isNil ifTrue:[ |
5933 |
"/ cannot open a submenu |
|
5934 |
^ self |
|
5935 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5936 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5937 |
self openSubmenu. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5938 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5939 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5940 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5941 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5942 |
visibleSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5943 |
"returns the current visible submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5944 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5945 |
subMenu notNil ifTrue:[ |
2219 | 5946 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5947 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5948 |
^ nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5949 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5950 |
|
1701 | 5951 |
|
5952 |
! ! |
|
5953 |
||
524 | 5954 |
!MenuPanel::Item methodsFor:'building'! |
5955 |
||
5956 |
aspectAt:aKey |
|
5957 |
"retursns value assigned to key or nil |
|
5958 |
" |
|
5959 |
|appl value| |
|
5960 |
||
5961 |
appl := menuPanel receiver. |
|
5962 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
5963 |
(appl isValueModel) ifTrue:[ |
2359 | 5964 |
^ appl value:aKey |
524 | 5965 |
]. |
5966 |
||
2123 | 5967 |
appl isNil ifTrue:[ |
2359 | 5968 |
appl := menuPanel application. |
2123 | 5969 |
]. |
5970 |
appl isNil ifTrue:[ ^ nil]. |
|
5971 |
||
5972 |
MessageNotUnderstood handle:[:ex| |
|
2359 | 5973 |
ex selector == aKey ifFalse:[ |
5974 |
ex reject |
|
5975 |
]. |
|
5976 |
self ifNotInUIBuilderInfoPrintCR: |
|
2545
e838be7f2c83
Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents:
2505
diff
changeset
|
5977 |
('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
|
5978 |
bindWith:appl className with:aKey). |
2123 | 5979 |
] do:[ |
2359 | 5980 |
aKey numArgs == 1 ifTrue:[ |
5981 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
5982 |
] ifFalse:[ |
|
5983 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
5984 |
value := appl aspectFor:aKey |
|
5985 |
] ifFalse:[ |
|
5986 |
value := appl perform:aKey |
|
5987 |
] |
|
5988 |
] |
|
524 | 5989 |
]. |
5990 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
5991 |
|
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
5992 |
"Modified: / 29.7.1998 / 11:59:50 / cg" |
524 | 5993 |
! ! |
5994 |
||
390 | 5995 |
!MenuPanel::Item methodsFor:'change & update'! |
5996 |
||
2614 | 5997 |
fontChanged |
5998 |
"called whenever the font changed |
|
5999 |
" |
|
6000 |
displayLabel notNil ifTrue:[ |
|
6001 |
displayLabelExtent := nil. |
|
6002 |
||
6003 |
subMenu notNil ifTrue:[ |
|
6004 |
subMenu font:(menuPanel font). |
|
6005 |
]. |
|
6006 |
]. |
|
6007 |
! |
|
6008 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6009 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6010 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6011 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6012 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6013 |
(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
|
6014 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6015 |
self isSeparator ifFalse:[ |
2359 | 6016 |
"/ NOT A SEPARATOR |
6017 |
||
6018 |
menuPanel shown ifTrue:[ |
|
6019 |
changedObject == enableChannel ifTrue:[ |
|
6020 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
6021 |
^ menuPanel selection:nil. |
|
6022 |
]. |
|
6023 |
^ self invalidate |
|
6024 |
]. |
|
6025 |
||
6026 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
6027 |
menuItem isButton ifTrue:[ |
|
6028 |
self invalidate |
|
6029 |
] ifFalse:[ |
|
6030 |
"/ invalidate the interactor only |
|
6031 |
"/ take any interactor; interactors has the same extent |
|
6032 |
form := menuPanel iconIndicationOff. |
|
6033 |
||
6034 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
6035 |
top:(layout top) |
|
6036 |
width:(form width) |
|
6037 |
height:(layout height). |
|
6038 |
||
6039 |
menuPanel invalidate:rect repairNow:false |
|
6040 |
]. |
|
6041 |
^ self |
|
6042 |
]. |
|
6043 |
]. |
|
498 | 6044 |
]. |
712 | 6045 |
|
6046 |
changedObject == isVisible ifTrue:[ |
|
2359 | 6047 |
menuPanel mustRearrange. |
6048 |
menuPanel rearrangeItems. |
|
6049 |
^ self. |
|
712 | 6050 |
]. |
6051 |
||
498 | 6052 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6053 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6054 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6055 |
updateIndicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6056 |
"update indicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6057 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6058 |
(indication notNil and:[indication isSymbol]) ifTrue:[ |
2219 | 6059 |
" indication is a selector otherwise a change notification |
6060 |
is raised from the model !!!! |
|
6061 |
" |
|
6062 |
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
|
6063 |
] |
390 | 6064 |
! ! |
6065 |
||
388 | 6066 |
!MenuPanel::Item methodsFor:'converting'! |
6067 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6068 |
asMenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6069 |
"convert to a MenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6070 |
" |
2359 | 6071 |
^ menuItem |
388 | 6072 |
! |
6073 |
||
6074 |
menuItem:aMenuItem |
|
6075 |
"setup attributes from a MenuItem |
|
6076 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6077 |
|lbl| |
389 | 6078 |
|
388 | 6079 |
menuPanel disabledRedrawDo:[ |
2359 | 6080 |
menuItem := aMenuItem. |
6081 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
6082 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6083 |
label := displayLabel := activeHelpText := nil. |
2359 | 6084 |
|
6085 |
self enabled:(menuItem enabled). |
|
6086 |
self indication:(menuItem indication). |
|
6087 |
self choice:(menuItem choice). |
|
6088 |
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
|
6089 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6090 |
"/ 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
|
6091 |
"/ but ... ?? |
2359 | 6092 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
6093 |
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
|
6094 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6095 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6096 |
self submenu:(menuItem submenu). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6097 |
self label:lbl. |
388 | 6098 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
6099 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
6100 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 6101 |
! ! |
6102 |
||
6103 |
!MenuPanel::Item methodsFor:'drawing'! |
|
6104 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6105 |
draw |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6106 |
"redraw item |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6107 |
" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6108 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6109 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6110 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6111 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6112 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6113 |
| |
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 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6116 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6117 |
self isSeparator ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6118 |
self drawSeparator. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6119 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6120 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6121 |
menuItem isButton ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6122 |
self drawButton. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6123 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6124 |
]. |
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 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6127 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6128 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6129 |
bgColor := menuPanel backgroundColor. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6130 |
paint := isSelected |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6131 |
ifTrue:[self activeBackgroundColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6132 |
ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6133 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6134 |
menuPanel enteredBackgroundColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6135 |
] ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6136 |
bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6137 |
]]. |
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 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6140 |
paint := ownBgCol |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6141 |
]. |
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 |
paint ~= bgColor ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6144 |
menuPanel paint:paint. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6145 |
menuPanel fillRectangle:layout. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6146 |
]. |
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 |
menuPanel showSeparatingLines ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6149 |
self drawSeparatingLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6150 |
]. |
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 |
self drawLabel. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6153 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6154 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6155 |
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
|
6156 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6157 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6158 |
x := layout left. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6159 |
y := layout top. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6160 |
w := layout width. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6161 |
h := layout height. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6162 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6163 |
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
|
6164 |
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
|
6165 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6166 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6167 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6168 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6169 |
drawButton |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6170 |
"draw as button |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6171 |
" |
2362 | 6172 |
|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
|
6173 |
x "{ Class:SmallInteger }" |
2143 | 6174 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6175 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6176 |
drawObject := displayLabel. |
2362 | 6177 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
6178 |
isSelected := self isSelected. |
2362 | 6179 |
|
6180 |
isSelected ifFalse:[ |
|
6181 |
"/ test whether button has pressed toggle behaviour |
|
6182 |
showSelected := (self isToggle and:[self indicationValue]). |
|
6183 |
] ifTrue:[ |
|
6184 |
showSelected := isSelected |
|
6185 |
]. |
|
6186 |
||
6187 |
showSelected ifTrue:[ |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6188 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6189 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6190 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6191 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6192 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6193 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6194 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6195 |
]. |
2059 | 6196 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6197 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6198 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6199 |
fg := menuPanel disabledForegroundColor. |
2059 | 6200 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6201 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6202 |
] |
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 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6205 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6206 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6207 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6208 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6209 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6210 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6211 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6212 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6213 |
]. |
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 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 6216 |
|
6217 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
2337 | 6218 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
6219 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6220 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6221 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6222 |
"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
|
6223 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6224 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6225 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6226 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6227 |
] ifFalse:[ |
2359 | 6228 |
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
|
6229 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6230 |
]. |
2143 | 6231 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6232 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6233 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6234 |
level := menuPanel buttonActiveLevel. |
2142 | 6235 |
x := x + 1 "level abs". |
2143 | 6236 |
y := y + 1 "level abs". |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6237 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6238 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2219 | 6239 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 6240 |
]. |
6241 |
||
2362 | 6242 |
drawObject isEmptyOrNil ifFalse:[ |
6243 |
etchFg notNil ifTrue:[ |
|
6244 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
6245 |
]. |
|
6246 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
6247 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6248 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6249 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6250 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6251 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6252 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6253 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6254 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6255 |
drawLabel |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6256 |
"draw a labeled entry; no button, no separator. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6257 |
" |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6258 |
|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
|
6259 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6260 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6261 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6262 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6263 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6264 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6265 |
drawObject := displayLabel. |
2362 | 6266 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6267 |
isSelected := self isSelected. |
2362 | 6268 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6269 |
isSelected ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6270 |
fg := self activeForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6271 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6272 |
isEnabled ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6273 |
self isEntered ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6274 |
fg := menuPanel enteredForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6275 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6276 |
fg := menuPanel foregroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6277 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6278 |
] ifFalse:[ |
2362 | 6279 |
fg := menuPanel disabledForegroundColor. |
6280 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
6281 |
drawObject := self disabledRawLabel |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6282 |
] |
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 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6286 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6287 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6288 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6289 |
((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
|
6290 |
y := t + ((h - form height) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6291 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6292 |
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
|
6293 |
x := x + 2 + form width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6294 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6295 |
|
2362 | 6296 |
drawObject isEmptyOrNil ifFalse:[ |
6297 |
etchFg notNil ifTrue:[ |
|
6298 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
6299 |
]. |
|
6300 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
6301 |
]. |
|
6302 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6303 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6304 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6305 |
"/ DRAW SHORTCUT KEY |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6306 |
|
2359 | 6307 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6308 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6309 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6310 |
) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6311 |
x := layout left + x. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6312 |
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
|
6313 |
y := y + menuPanel font ascent. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6314 |
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
|
6315 |
]. |
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 |
"/ DRAW SUBMENU INDICATION |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6318 |
|
2362 | 6319 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[ |
6320 |
^ self |
|
6321 |
]. |
|
6322 |
arrow := menuPanel rightArrow. |
|
6323 |
x := layout right - arrow width - HorizontalInset. |
|
6324 |
y := t + (h - arrow height // 2). |
|
6325 |
||
6326 |
(menuPanel styleSheet is3D not |
|
6327 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
6328 |
^ menuPanel displayForm:arrow x:x y:y |
|
6329 |
]. |
|
6330 |
cLa := menuPanel shadowColor. |
|
6331 |
cLb := menuPanel lightColor. |
|
6332 |
||
6333 |
isSelected ifFalse:[ |
|
6334 |
fg := cLa. |
|
6335 |
cLa := cLb. |
|
6336 |
cLb := fg |
|
6337 |
]. |
|
6338 |
menuPanel paint:cLa. |
|
6339 |
menuPanel displayForm:arrow x:x y:y. |
|
6340 |
menuPanel paint:cLb. |
|
6341 |
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
|
6342 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6343 |
"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
|
6344 |
! |
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 |
drawMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6347 |
"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
|
6348 |
" |
2220 | 6349 |
|x y icon bAbsLevel| |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6350 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6351 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6352 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6353 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6354 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6355 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6356 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6357 |
^ self |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6358 |
] |
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 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6361 |
x := layout right - icon width. |
2460 | 6362 |
false "delayedMenuIndicatorVerticalPosition == #center" ifTrue:[ |
2220 | 6363 |
y := layout height - icon height // 2 + layout top. |
6364 |
] ifFalse:[ |
|
6365 |
y := layout bottom - icon height - 2. |
|
6366 |
]. |
|
6367 |
||
6368 |
bAbsLevel := 0. |
|
2359 | 6369 |
menuItem isButton ifTrue:[ |
2220 | 6370 |
self isSelected ifTrue:[ |
6371 |
x := x + 1. |
|
6372 |
y := y + 1. |
|
6373 |
]. |
|
6374 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
6375 |
x := x - bAbsLevel. |
|
6376 |
y := y - bAbsLevel. |
|
6377 |
]. |
|
6378 |
x := x - 1 "- HorizontalInset". |
|
6379 |
||
6380 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
6381 |
icon := menuPanel lightenedImageOnDevice:icon |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6382 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6383 |
icon displayOn:menuPanel x:x y:y. |
2220 | 6384 |
|
2234 | 6385 |
(false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ]) |
2220 | 6386 |
ifTrue:[ |
6387 |
menuPanel paint:menuPanel buttonShadowColor. |
|
6388 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
6389 |
menuPanel paint:menuPanel buttonLightColor. |
|
6390 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
6391 |
]. |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6392 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6393 |
|
2059 | 6394 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6395 |
"draw a labeled entry; no button, no separator. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6396 |
" |
2614 | 6397 |
|mfont labelExtent |
1727 | 6398 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6399 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6400 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6401 |
| |
2059 | 6402 |
|
2373 | 6403 |
mfont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6404 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6405 |
menuPanel paint:fg. |
2614 | 6406 |
labelExtent := self displayLabelExtent. |
6407 |
||
6408 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 6409 |
"/ menuPanel centerItems ifTrue:[self halt]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6410 |
aLabel isArray ifFalse:[ |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6411 |
y := y + (aLabel ascentOn:menuPanel). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6412 |
"/ aLabel isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6413 |
"/ y := y + fontAscent. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6414 |
"/ ]. |
2337 | 6415 |
aLabel displayOn:menuPanel x:x y:y. |
1727 | 6416 |
] ifTrue:[ |
2337 | 6417 |
aLabel do:[:el| |
6418 |
el notNil ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6419 |
y0 := y + (el ascentOn:menuPanel). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6420 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6421 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6422 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6423 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6424 |
"/ ]. |
2614 | 6425 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
2337 | 6426 |
el displayOn:menuPanel x:x0 y:y0. |
6427 |
y := y + 1 + (el heightOn:menuPanel) |
|
6428 |
] ifFalse:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6429 |
y := y + (self spaceBetweenEmptyLines) |
2337 | 6430 |
] |
6431 |
]. |
|
1727 | 6432 |
]. |
6433 |
menuPanel setFont:mfont |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6434 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6435 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6436 |
drawSeparatingLines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6437 |
"draw separating lines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6438 |
" |
2059 | 6439 |
|myIndex lfSep rtSep items prevItem nextItem |
6440 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6441 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6442 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6443 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6444 |
b "{ Class:SmallInteger }" |
706 | 6445 |
| |
2059 | 6446 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6447 |
items := menuPanel items. |
2059 | 6448 |
myIndex := items identityIndexOf:self. |
6449 |
||
6450 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
6451 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
6452 |
||
6453 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
6454 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
6455 |
||
6456 |
(lfSep or:[rtSep]) ifFalse:[ |
|
2219 | 6457 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6458 |
]. |
2059 | 6459 |
|
6460 |
lightColor := menuPanel lightColor. |
|
6461 |
shadowColor := menuPanel shadowColor. |
|
6462 |
||
6463 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6464 |
|
608 | 6465 |
l := layout left. |
6466 |
t := layout top. |
|
6467 |
r := layout right. |
|
6468 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6469 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6470 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6471 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
6472 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
6473 |
||
6474 |
menuPanel paint:shadowColor. |
|
6475 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
6476 |
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
|
6477 |
] ifFalse:[ |
2219 | 6478 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
6479 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
6480 |
||
6481 |
menuPanel paint:shadowColor. |
|
6482 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
6483 |
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
|
6484 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6485 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6486 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6487 |
drawSeparator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6488 |
"draw as separator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6489 |
" |
2059 | 6490 |
|type lightColor shadowColor isDouble |
6491 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6492 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6493 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6494 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6495 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6496 |
| |
2059 | 6497 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6498 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6499 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
2219 | 6500 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6501 |
]. |
2059 | 6502 |
|
6503 |
isDouble := type == #doubleLine. |
|
6504 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6505 |
lightColor := menuPanel lightColor. |
2059 | 6506 |
shadowColor := menuPanel shadowColor. |
6507 |
menuPanel paint:shadowColor. |
|
6508 |
||
6509 |
left := layout left. |
|
6510 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6511 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6512 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6513 |
x0 := left + HorizontalInset. |
6514 |
x1 := layout right - HorizontalInset. |
|
6515 |
y0 := top - 1 + (layout height // 2). |
|
6516 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
6517 |
||
6518 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
6519 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
6520 |
||
6521 |
menuPanel paint:lightColor. |
|
6522 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
6523 |
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
|
6524 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6525 |
] ifFalse:[ |
2219 | 6526 |
y1 := layout bottom. |
6527 |
x0 := left - 1 + (layout width // 2). |
|
6528 |
y0 := top. |
|
6529 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
6530 |
||
6531 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
6532 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
6533 |
||
6534 |
menuPanel paint:lightColor. |
|
6535 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
6536 |
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
|
6537 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6538 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6539 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6540 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6541 |
|
2362 | 6542 |
layout isNil ifTrue:[^ self]. |
6543 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6544 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
2362 | 6545 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6546 |
] |
388 | 6547 |
! ! |
6548 |
||
6549 |
!MenuPanel::Item methodsFor:'initialization'! |
|
6550 |
||
6551 |
destroy |
|
616 | 6552 |
"destroy submenus, remove dependencies |
388 | 6553 |
" |
616 | 6554 |
self submenu:nil. |
6555 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6556 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6557 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6558 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6559 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
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 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7313 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 7314 |
|
2018 | 7315 |
icon |
2016 | 7316 |
"This resource specification was automatically generated |
7317 |
by the ImageEditor of ST/X." |
|
7318 |
||
7319 |
"Do not manually edit this!! If it is corrupted, |
|
7320 |
the ImageEditor may not be able to read the specification." |
|
7321 |
||
7322 |
" |
|
2018 | 7323 |
self icon inspect |
7324 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 7325 |
" |
7326 |
||
7327 |
<resource: #image> |
|
7328 |
||
7329 |
^Icon |
|
2219 | 7330 |
constantNamed:#'MenuPanel::Scrolling class icon' |
7331 |
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 | 7332 |
! ! |
7333 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7334 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 7335 |
|
7336 |
new |
|
7337 |
^ self basicNew initialize |
|
7338 |
! ! |
|
7339 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7340 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 7341 |
|
7342 |
activeMenu |
|
7343 |
"returns the active menu the scrolling is activated on; nil |
|
7344 |
is returned if scrolling is deactivated |
|
7345 |
" |
|
7346 |
^ activeMenu |
|
7347 |
! |
|
7348 |
||
7349 |
direction |
|
7350 |
"returns the scroll-direction |
|
7351 |
" |
|
7352 |
^ direction |
|
7353 |
! |
|
7354 |
||
7355 |
iconAt:aDirection on:aMenu |
|
2018 | 7356 |
|icon device index| |
2016 | 7357 |
|
7358 |
device := aMenu device. |
|
7359 |
||
7360 |
aDirection == #PREV ifTrue:[ |
|
2219 | 7361 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
7362 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 7363 |
] ifFalse:[ |
2219 | 7364 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
7365 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 7366 |
]. |
7367 |
||
7368 |
icon := icons at:index. |
|
7369 |
||
7370 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
2219 | 7371 |
icon := self class icon. |
7372 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
7373 |
ifFalse:[ icon := icon copy ]. |
|
7374 |
||
7375 |
icon := icon onDevice:device. |
|
7376 |
icon clearMaskedPixels. |
|
7377 |
icons at:index put:icon |
|
2018 | 7378 |
]. |
7379 |
^ icon |
|
2016 | 7380 |
! ! |
7381 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7382 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 7383 |
|
7384 |
initialize |
|
7385 |
||
7386 |
semaLock := RecursionLock new. |
|
2018 | 7387 |
icons := Array new:4. |
2016 | 7388 |
! ! |
7389 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7390 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 7391 |
|
7392 |
isActive |
|
7393 |
"returns true if scrolling is activated |
|
7394 |
" |
|
7395 |
^ activeMenu notNil |
|
7396 |
! ! |
|
7397 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7398 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 7399 |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7400 |
startIfRequiredAt:aDirection on:aMenu |
2016 | 7401 |
"start scrolling; returns true if scrolling is activated |
7402 |
" |
|
7403 |
|bounds index| |
|
7404 |
||
7405 |
semaLock critical:[ |
|
2219 | 7406 |
self stop. |
7407 |
||
7408 |
( aDirection notNil |
|
7409 |
and:[aMenu notNil |
|
7410 |
and:[(bounds := aMenu scrollerBoundsAt:aDirection) notNil]] |
|
7411 |
) ifTrue:[ |
|
7412 |
activeMenu := aMenu. |
|
7413 |
direction := aDirection. |
|
7414 |
||
7415 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
7416 |
||
7417 |
index ~~ 0 ifTrue:[ |
|
7418 |
scrollTask := |
|
7419 |
[ |
|
7420 |
|item step| |
|
7421 |
||
7422 |
[ |
|
7423 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
7424 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
7425 |
aMenu makeItemVisible:item. |
|
7426 |
index := index + step. |
|
7427 |
]. |
|
7428 |
||
7429 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
7430 |
||
7431 |
[ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[ |
|
7432 |
aMenu makeItemVisible:item. |
|
7433 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
7434 |
index := index + step. |
|
7435 |
]. |
|
7436 |
item := nil. |
|
7437 |
] ensure:[ |
|
7438 |
scrollTask := nil. |
|
7439 |
||
7440 |
item notNil ifTrue:[ |
|
7441 |
"/ process was killed |
|
7442 |
aMenu invalidate:bounds |
|
7443 |
] |
|
7444 |
] |
|
7445 |
] forkAt:8. |
|
7446 |
] |
|
7447 |
] |
|
2016 | 7448 |
]. |
7449 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7450 |
|
2048 | 7451 |
"Created: ca" |
7452 |
||
7453 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 7454 |
! |
7455 |
||
7456 |
stop |
|
7457 |
"stop scrolling; returns true if the scrolling was activated otherwise false |
|
7458 |
" |
|
7459 |
|task resp| |
|
7460 |
||
7461 |
activeMenu isNil ifTrue:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7462 |
^ false |
2016 | 7463 |
]. |
7464 |
semaLock critical:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7465 |
resp := activeMenu notNil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7466 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7467 |
(task := scrollTask) notNil ifTrue:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7468 |
scrollTask := nil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7469 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7470 |
Error handle:[:ex| |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7471 |
] do:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7472 |
task terminateWithAllSubprocessesInGroup. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7473 |
task waitUntilTerminated. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7474 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7475 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7476 |
activeMenu := direction := nil. |
2016 | 7477 |
]. |
7478 |
^ resp |
|
7479 |
! ! |
|
7480 |
||
388 | 7481 |
!MenuPanel class methodsFor:'documentation'! |
7482 |
||
7483 |
version |
|
2614 | 7484 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.380 2004-02-01 11:49:59 ca Exp $' |
388 | 7485 |
! ! |
2199 | 7486 |
|
388 | 7487 |
MenuPanel initialize! |