author | Claus Gittinger <cg@exept.de> |
Tue, 11 Dec 2001 12:53:42 +0100 | |
changeset 2062 | 31ba9af25394 |
parent 2061 | faf64f2cd28e |
child 2063 | 8bff9e49f1e9 |
permissions | -rw-r--r-- |
2005 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3 |
All Rights Reserved |
|
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 |
||
389 | 16 |
SimpleView subclass:#MenuPanel |
689 | 17 |
instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu |
18 |
shortKeyInset selection items groupSizes receiver enableChannel |
|
19 |
menuHolder enabled onLevel offLevel fgColor activeFgColor |
|
2059 | 20 |
lastActiveMenu activeBgColor disabledFgColor |
21 |
disabledEtchedFgColor groupDividerSize itemSpace fitFirstPanel |
|
22 |
rightArrow rightArrowShadow selectionFrameBrightColor |
|
23 |
selectionFrameDarkColor buttonLightColor buttonShadowColor |
|
24 |
buttonHalfLightColor buttonHalfShadowColor enteredItem |
|
25 |
buttonEnteredBgColor prevFocusView previousPointerGrab |
|
26 |
previousKeyboardGrab relativeGrabOrigin hasImplicitGrap |
|
27 |
iconIndicationOff iconIndicationOn iconRadioGroupOff |
|
28 |
iconRadioGroupOn iconIndicationDisabledOff |
|
29 |
iconIndicationDisabledOn iconRadioGroupDisabledOff |
|
30 |
iconRadioGroupDisabledOn scrolling' |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
31 |
classVariableNames:'InitialSelectionQuerySignal DefaultAdornment ShortcutKeyOffset |
689 | 32 |
DefaultGroupDividerSize DefaultHilightLevel DefaultLevel |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
33 |
DefaultItemSpace DefaultButtonItemSpace DefaultForegroundColor |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
34 |
DefaultBackgroundColor DefaultHilightForegroundColor |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
35 |
DefaultHilightBackgroundColor DefaultDisabledForegroundColor |
2059 | 36 |
DefaultDisabledEtchedForegroundColor DefaultEnteredLevel |
37 |
DefaultSelectionFollowsMouse DefaultOpenOnSelect |
|
38 |
DefaultFitFirstPanel RightArrowForm RightArrowShadowForm |
|
39 |
SelectionFrameBrightColor SelectionFrameDarkColor |
|
40 |
ButtonActiveLevel ButtonPassiveLevel ButtonActiveBackgroundColor |
|
41 |
ButtonPassiveBackgroundColor ButtonLightColor ButtonShadowColor |
|
42 |
ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle Images |
|
43 |
LigthenedImages ButtonEnteredBackgroundColor ButtonEnteredLevel' |
|
689 | 44 |
poolDictionaries:'' |
45 |
category:'Views-Menus' |
|
388 | 46 |
! |
47 |
||
48 |
Object subclass:#Item |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
49 |
instanceVariableNames:'layout menuPanel subMenu rawLabel rawLabelExtent disabledRawLabel |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
50 |
enableChannel nameKey value label activeHelpKey activeHelpText |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
51 |
submenuChannel startGroup isButton isVisible hideMenuOnActivated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
52 |
indication accessCharacterPosition shortcutKey argument choice |
1767 | 53 |
choiceValue showBusyCursorWhilePerforming accessCharacter font |
1841 | 54 |
keepLinkedMenu triggerOnDown' |
689 | 55 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
1765 | 56 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
689 | 57 |
poolDictionaries:'' |
58 |
privateIn:MenuPanel |
|
388 | 59 |
! |
60 |
||
2016 | 61 |
Object subclass:#Scrolling |
2018 | 62 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
2016 | 63 |
classVariableNames:'' |
64 |
poolDictionaries:'' |
|
65 |
privateIn:MenuPanel |
|
66 |
! |
|
67 |
||
388 | 68 |
!MenuPanel class methodsFor:'documentation'! |
69 |
||
2005 | 70 |
copyright |
71 |
" |
|
72 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
73 |
All Rights Reserved |
|
74 |
||
75 |
This software is furnished under a license and may be used |
|
76 |
only in accordance with the terms of that license and with the |
|
77 |
inclusion of the above copyright notice. This software may not |
|
78 |
be provided or otherwise made available to, or used by, any |
|
79 |
other person. No title to or ownership of the software is |
|
80 |
hereby transferred. |
|
81 |
" |
|
82 |
||
388 | 83 |
! |
84 |
||
85 |
documentation |
|
86 |
" |
|
87 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
88 |
||
89 |
not yet finished MenuPanel class - this will eventually replace |
|
90 |
most of the MenuView and PopUpMenu stuff. |
|
91 |
(and hopefully be ST-80 compatible ...) |
|
92 |
||
502 | 93 |
To create a menu, there exists a MenuEditor which will generate |
94 |
a menu specification. |
|
95 |
||
96 |
||
2061 | 97 |
Notice: |
98 |
This is going to replace the obsolete MenuView. |
|
99 |
||
100 |
DefaultSelectionFollowsMouse := true. |
|
101 |
DefaultSelectionFollowsMouse := false. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
102 |
|
388 | 103 |
[author:] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
104 |
Claus Atzkern |
388 | 105 |
|
106 |
[see also:] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
107 |
Menu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
108 |
MenuItem |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
109 |
MenuEditor |
388 | 110 |
" |
111 |
! |
|
112 |
||
113 |
examples |
|
114 |
||
115 |
" |
|
116 |
start as PullDownMenu |
|
1767 | 117 |
[exBegin] |
388 | 118 |
|top subView mview desc s1 s2 s3 img lbs labels| |
119 |
||
120 |
top := StandardSystemView new. |
|
121 |
||
436 | 122 |
mview := MenuPanel in:top. |
388 | 123 |
|
502 | 124 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 125 |
mview level:2. |
126 |
mview verticalLayout:false. |
|
127 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 128 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 129 |
mview labels:lbs. |
130 |
mview shortcutKeyAt:2 put:#Cut. |
|
131 |
mview accessCharacterPositionAt:1 put:1. |
|
132 |
mview accessCharacterPositionAt:2 put:2. |
|
133 |
||
134 |
mview enabledAt:5 put:false. |
|
135 |
mview groupSizes:#( 2 2 ). |
|
436 | 136 |
s1 := MenuPanel labels:labels. |
388 | 137 |
s1 accessCharacterPositionAt:1 put:1. |
138 |
s1 accessCharacterPositionAt:2 put:2. |
|
139 |
s1 groupSizes:#( 2 2 ). |
|
436 | 140 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
141 |
s3 := MenuPanel labels:lbs. |
|
388 | 142 |
|
143 |
s1 subMenuAt:2 put:s2. |
|
436 | 144 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 145 |
s2 subMenuAt:3 put:s3. |
436 | 146 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 147 |
s3 shortcutKeyAt:3 put:$q. |
148 |
||
149 |
mview subMenuAt:1 put:s1. |
|
436 | 150 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 151 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
152 |
s1 shortcutKeyAt:1 put:#Copy. |
|
153 |
s1 shortcutKeyAt:3 put:#Paste. |
|
154 |
||
436 | 155 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 156 |
top extent:(mview preferredExtent). |
388 | 157 |
top open. |
1767 | 158 |
[exEnd] |
159 |
||
160 |
[exBegin] |
|
161 |
|top menu view item| |
|
162 |
||
163 |
top := StandardSystemView extent:240@100. |
|
164 |
menu := MenuPanel in:top. |
|
165 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
166 |
menu verticalLayout:false. |
|
167 |
||
168 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
169 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
170 |
||
171 |
view := ClockView new. |
|
172 |
view preferredExtent:100@100. |
|
173 |
item := menu itemAt:3. |
|
174 |
item submenu:view. |
|
175 |
||
176 |
view := SimpleView new. |
|
177 |
view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new). |
|
178 |
view preferredExtent:(400@50). |
|
179 |
item := menu itemAt:2. |
|
180 |
item submenu:view. |
|
181 |
||
182 |
menu origin:0@0 corner:1.0@30. |
|
183 |
top open. |
|
184 |
[exEnd] |
|
388 | 185 |
|
186 |
||
187 |
start as PopUpMenu |
|
1767 | 188 |
[exBegin] |
388 | 189 |
|subView mview desc s1 s2 s3 img lbs labels| |
190 |
||
436 | 191 |
mview := MenuPanel new. |
502 | 192 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 193 |
mview level:2. |
194 |
||
195 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 196 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 197 |
mview labels:lbs. |
198 |
||
436 | 199 |
s1 := MenuPanel labels:labels. |
200 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
201 |
s3 := MenuPanel labels:lbs. |
|
388 | 202 |
s1 subMenuAt:2 put:s2. |
436 | 203 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 204 |
s2 subMenuAt:3 put:s3. |
436 | 205 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 206 |
s3 shortcutKeyAt:3 put:$q. |
207 |
||
208 |
mview subMenuAt:1 put:s1. |
|
436 | 209 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 210 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
211 |
s1 shortcutKeyAt:1 put:#Copy. |
|
212 |
s1 shortcutKeyAt:3 put:#Paste. |
|
213 |
||
436 | 214 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 215 |
mview startUp |
1767 | 216 |
[exEnd] |
388 | 217 |
|
218 |
||
219 |
start from menu spec |
|
1767 | 220 |
[exBegin] |
388 | 221 |
|menu| |
222 |
||
436 | 223 |
menu := MenuPanel menu: |
1767 | 224 |
#(#Menu #( #(#MenuItem |
225 |
#label: 'File' |
|
226 |
#submenu: |
|
227 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
228 |
(#MenuItem |
|
229 |
#label: 'edit' |
|
230 |
#submenu: |
|
231 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
232 |
#(#MenuItem #label: 'close' #value:#close) |
|
233 |
) |
|
234 |
nil |
|
235 |
nil |
|
236 |
) |
|
237 |
) |
|
238 |
#(#MenuItem #label: 'help' #value:#help ) |
|
239 |
) |
|
240 |
nil |
|
241 |
nil |
|
242 |
) |
|
243 |
) |
|
244 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
245 |
#(#MenuItem #label: 'Bar' |
|
246 |
#submenu: |
|
247 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
248 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
249 |
) |
|
250 |
nil |
|
251 |
nil |
|
252 |
) |
|
253 |
) |
|
254 |
) |
|
255 |
#( 2 ) |
|
256 |
nil |
|
257 |
) decodeAsLiteralArray. |
|
388 | 258 |
|
259 |
menu verticalLayout:false. |
|
260 |
Transcript showCR:(menu startUp). |
|
1767 | 261 |
[exEnd] |
388 | 262 |
|
263 |
" |
|
264 |
||
265 |
! ! |
|
266 |
||
267 |
!MenuPanel class methodsFor:'instance creation'! |
|
268 |
||
269 |
fromSpec:aSpec |
|
270 |
^ self fromSpec:aSpec receiver:nil |
|
271 |
! |
|
272 |
||
273 |
fromSpec:aSpec receiver:aReceiver |
|
274 |
|menu| |
|
275 |
||
276 |
aSpec notNil ifTrue:[ |
|
1955 | 277 |
menu := Menu new. |
278 |
menu receiver:aReceiver. |
|
279 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 280 |
]. |
281 |
^ self menu:menu receiver:aReceiver |
|
282 |
! |
|
283 |
||
284 |
labels:labels |
|
285 |
^ self labels:labels nameKeys:nil receiver:nil |
|
286 |
! |
|
287 |
||
288 |
labels:labels nameKeys:nameKeys |
|
289 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
290 |
! |
|
291 |
||
292 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
293 |
|mview| |
|
294 |
||
295 |
mview := self menu:nil receiver:aReceiver. |
|
296 |
mview labels:labels. |
|
297 |
mview nameKeys:nameKeys. |
|
298 |
^ mview |
|
299 |
||
300 |
! |
|
301 |
||
502 | 302 |
labels:labels receiver:aReceiver |
303 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
304 |
! |
|
305 |
||
388 | 306 |
menu:aMenu |
307 |
^ self menu:aMenu receiver:nil |
|
308 |
! |
|
309 |
||
310 |
menu:aMenu receiver:aReceiver |
|
311 |
|mview| |
|
312 |
||
313 |
mview := self new. |
|
1955 | 314 |
|
315 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
316 |
"/ no receiver specified in the menu; thus set the receiver immediately |
|
317 |
mview receiver:aReceiver |
|
318 |
]. |
|
319 |
||
388 | 320 |
mview menu:aMenu. |
321 |
||
1955 | 322 |
|
388 | 323 |
"/ a menu itself may contain a receiver |
324 |
"/ thus we do not overwrite the receiver |
|
325 |
||
326 |
aReceiver notNil ifTrue:[ |
|
1955 | 327 |
mview receiver:aReceiver |
388 | 328 |
]. |
329 |
^ mview |
|
330 |
! ! |
|
331 |
||
332 |
!MenuPanel class methodsFor:'class initialization'! |
|
333 |
||
334 |
initialize |
|
657 | 335 |
" |
336 |
DefaultAdornment := nil. |
|
337 |
self initialize |
|
338 |
" |
|
339 |
||
388 | 340 |
InitialSelectionQuerySignal isNil ifTrue:[ |
1117 | 341 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 342 |
]. |
390 | 343 |
|
388 | 344 |
DefaultAdornment isNil ifTrue:[ |
1117 | 345 |
DefaultAdornment := IdentityDictionary new |
346 |
at:#showSeparatingLines put:false; |
|
347 |
at:#showGroupDivider put:true; |
|
348 |
at:#verticalLayout put:true; |
|
349 |
at:#item put:nil; |
|
350 |
at:#value put:nil; |
|
351 |
yourself |
|
388 | 352 |
]. |
353 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
354 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 355 |
! |
356 |
||
357 |
preSnapshot |
|
358 |
"remove all resources |
|
359 |
" |
|
360 |
Images := nil. |
|
361 |
LigthenedImages := nil. |
|
362 |
||
616 | 363 |
! ! |
364 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
365 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
366 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
367 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
368 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
369 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
370 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
371 |
"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
|
372 |
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
|
373 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
374 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
375 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
376 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
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 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
379 |
<resource: #image> |
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 |
^Icon |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
382 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
383 |
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] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
384 |
! |
1798
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 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
387 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
388 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
389 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
390 |
"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
|
391 |
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
|
392 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
393 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
394 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
395 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
396 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
397 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
398 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
399 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
400 |
^Icon |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
401 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
402 |
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] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
403 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
404 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
405 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
406 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
407 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
408 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
409 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
410 |
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
|
411 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
412 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
413 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
414 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
415 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
416 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
417 |
<resource: #image> |
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 |
^Icon |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
420 |
constantNamed:#'MenuPanel iconIndicationOff' |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
421 |
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] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
422 |
! |
1726
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 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
425 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
426 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
427 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
428 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
429 |
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
|
430 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
431 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
432 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
433 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
434 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
435 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
436 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
437 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
438 |
^Icon |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
439 |
constantNamed:#'MenuPanel iconIndicationOn' |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
440 |
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] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
441 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
442 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
443 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
444 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
445 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
446 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
447 |
"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
|
448 |
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
|
449 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
450 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
451 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
452 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
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 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
455 |
<resource: #image> |
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 |
^Icon |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
458 |
constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
459 |
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] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
460 |
! |
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 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
463 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
464 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
465 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
466 |
"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
|
467 |
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
|
468 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
469 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
470 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
471 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
472 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
473 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
474 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
475 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
476 |
^Icon |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
477 |
constantNamed:#'MenuPanel iconRadioGroupDisabledOn' |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
478 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DY@Z(AH@@+AI@@FLR@@@#D @@H1H@@BLRP@A#AX@@#@Z$A(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] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
479 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
480 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
481 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
482 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
483 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
484 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
485 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
486 |
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
|
487 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
488 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
489 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
490 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
491 |
" |
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 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
494 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
495 |
^Icon |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
496 |
constantNamed:#'MenuPanel iconRadioGroupOff' |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
497 |
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] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
498 |
! |
1726
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 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
501 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
502 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
503 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
504 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
505 |
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
|
506 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
507 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
508 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
509 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
510 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
511 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
512 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
513 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
514 |
^Icon |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
515 |
constantNamed:#'MenuPanel iconRadioGroupOn' |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
516 |
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] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
517 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
518 |
|
616 | 519 |
!MenuPanel class methodsFor:'defaults'! |
450 | 520 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
521 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
522 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
523 |
ex: |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
524 |
&File mnemonic := Cmdf |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
525 |
F&ile mnemonic := Cmdi |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
526 |
..... |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
527 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
528 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
529 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
530 |
|
450 | 531 |
updateStyleCache |
657 | 532 |
|
1699 | 533 |
<resource: #style (#'menu.foregroundColor' #'menu.backgroundColor' |
2059 | 534 |
#'menu.hilightForegroundColor' #'menu.hilightBackgroundColor' |
535 |
#'menu.disabledForegroundColor' #'menu.disabledEtchedForegroundColor' |
|
536 |
#'menu.buttonEnteredBackgroundColor' |
|
537 |
#'menu.hilightLevel' #'menu.groupDividerSize' |
|
538 |
#'menu.itemSpace' #'menu.buttonItemSpace' |
|
1699 | 539 |
#'menu.fitFirstPanel' #'menu.buttonActiveLevel' |
2059 | 540 |
#'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
1699 | 541 |
#'menu.selectionFollowsMouse' #'menu.enteredLevel' |
542 |
#'viewBackground' |
|
2059 | 543 |
#'pullDownMenu.level' |
544 |
#'pullDownMenu.hilightLevel' |
|
545 |
#'button.disabledForegroundColor' #'button.disabledEtchedForegroundColor' |
|
546 |
#'button.enteredBackgroundColor' |
|
1699 | 547 |
#'button.activeBackgroundColor' #'button.backgroundColor' |
548 |
#'button.lightColor' #'button.shadowColor' |
|
549 |
#'button.halfLightColor' #'button.halfShadowColor' |
|
550 |
#'button.passiveLevel' #'button.activeLevel' |
|
551 |
#'button.edgeStyle')> |
|
552 |
||
553 |
||
554 |
|style styleSheet| |
|
555 |
||
556 |
styleSheet := StyleSheet. |
|
557 |
style := styleSheet name. |
|
558 |
||
559 |
DefaultForegroundColor := styleSheet colorAt:#'menu.foregroundColor' |
|
560 |
default:Color black. |
|
561 |
||
562 |
DefaultBackgroundColor := styleSheet colorAt:#'menu.backgroundColor' |
|
563 |
default:DefaultViewBackgroundColor. |
|
564 |
||
565 |
DefaultHilightForegroundColor := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
566 |
||
567 |
DefaultHilightForegroundColor isNil ifTrue:[ |
|
568 |
styleSheet is3D ifTrue:[ |
|
569 |
DefaultHilightForegroundColor := DefaultForegroundColor. |
|
570 |
] ifFalse:[ |
|
571 |
DefaultHilightForegroundColor := DefaultBackgroundColor. |
|
572 |
]. |
|
573 |
]. |
|
574 |
||
575 |
DefaultDisabledForegroundColor := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
576 |
DefaultDisabledForegroundColor isNil ifTrue:[ |
|
577 |
DefaultDisabledForegroundColor := styleSheet colorAt:#'button.disabledForegroundColor' |
|
578 |
default:Color darkGray. |
|
579 |
]. |
|
2059 | 580 |
DefaultDisabledEtchedForegroundColor := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
581 |
DefaultDisabledEtchedForegroundColor isNil ifTrue:[ |
|
582 |
DefaultDisabledEtchedForegroundColor := styleSheet colorAt:#'button.disabledEtchedForegroundColor'. |
|
583 |
]. |
|
1699 | 584 |
|
585 |
DefaultHilightBackgroundColor := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
586 |
||
587 |
DefaultHilightBackgroundColor isNil ifTrue:[ |
|
588 |
style == #motif ifTrue:[ |
|
589 |
DefaultHilightBackgroundColor := DefaultBackgroundColor |
|
590 |
] ifFalse:[ |
|
591 |
DefaultHilightBackgroundColor := styleSheet is3D ifFalse:[DefaultForegroundColor] |
|
592 |
ifTrue:[DefaultBackgroundColor] |
|
593 |
] |
|
594 |
]. |
|
595 |
||
596 |
DefaultLevel := styleSheet at:#'pullDownMenu.level' default:0. |
|
1337 | 597 |
|
616 | 598 |
(style == #motif or:[style == #iris]) ifTrue:[ |
1699 | 599 |
DefaultHilightLevel := 2. |
600 |
DefaultLevel := DefaultLevel + 1. |
|
616 | 601 |
] ifFalse:[ |
1699 | 602 |
(DefaultHilightLevel := styleSheet at:'pullDownMenu.hilightLevel') isNil ifTrue:[ |
603 |
DefaultHilightLevel := styleSheet at:'menu.hilightLevel' default:0. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
604 |
]. |
1699 | 605 |
styleSheet is3D ifTrue:[DefaultLevel := DefaultLevel + 1]. |
606 |
]. |
|
607 |
||
608 |
DefaultGroupDividerSize := styleSheet at:#'menu.groupDividerSize' default:6. |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
609 |
DefaultItemSpace := styleSheet at:#'menu.itemSpace' default:2. |
1699 | 610 |
DefaultButtonItemSpace := styleSheet at:#'menu.buttonItemSpace' default:0. |
611 |
DefaultFitFirstPanel := styleSheet at:#'menu.fitFirstPanel' default:true. |
|
616 | 612 |
|
829 | 613 |
MenuView updateStyleCache. |
1699 | 614 |
DefaultFont := MenuView defaultFont. |
616 | 615 |
RightArrowForm := SelectionInListView rightArrowFormOn:Display. |
616 |
||
1054
f56416a8d26b
win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents:
1051
diff
changeset
|
617 |
(style ~~ #os2 and:[style ~~ #win95]) ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
618 |
RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display. |
616 | 619 |
] ifFalse:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
620 |
RightArrowShadowForm := nil |
616 | 621 |
]. |
622 |
||
730 | 623 |
SelectionFrameBrightColor := Color white. |
624 |
SelectionFrameDarkColor := Color black. |
|
625 |
||
1699 | 626 |
ButtonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
627 |
ButtonActiveLevel isNil ifTrue:[ |
1699 | 628 |
ButtonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
629 |
]. |
|
630 |
ButtonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
631 |
ButtonPassiveLevel isNil ifTrue:[ |
1699 | 632 |
ButtonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0]). |
633 |
]. |
|
634 |
ButtonActiveBackgroundColor := styleSheet at:#'button.activeBackgroundColor' default: DefaultBackgroundColor. |
|
635 |
ButtonPassiveBackgroundColor := (styleSheet at:#'button.backgroundColor') ? (styleSheet at:'viewBackground') ? DefaultBackgroundColor. |
|
636 |
||
637 |
ButtonLightColor := styleSheet at:#'button.lightColor'. |
|
1336 | 638 |
ButtonLightColor isNil ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
639 |
ButtonLightColor := (ButtonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened. "/ Color white |
1336 | 640 |
]. |
1699 | 641 |
ButtonShadowColor := styleSheet at:#'button.shadowColor'. |
1336 | 642 |
ButtonShadowColor isNil ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
643 |
ButtonShadowColor := (ButtonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened. "/ Color white |
1699 | 644 |
]. |
645 |
ButtonHalfLightColor := styleSheet at:#'button.halfLightColor'. |
|
646 |
ButtonHalfShadowColor := styleSheet at:#'button.halfShadowColor'. |
|
647 |
ButtonEdgeStyle := styleSheet at:#'button.edgeStyle'. |
|
648 |
||
649 |
ButtonEnteredBackgroundColor := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
650 |
ButtonEnteredBackgroundColor isNil ifTrue:[ |
1699 | 651 |
ButtonEnteredBackgroundColor := styleSheet colorAt:#'button.enteredBackgroundColor' |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
652 |
default:ButtonPassiveBackgroundColor. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
653 |
]. |
1699 | 654 |
ButtonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:ButtonPassiveLevel. |
655 |
||
656 |
DefaultSelectionFollowsMouse := styleSheet at:#'menu.selectionFollowsMouse' default:false. |
|
657 |
DefaultEnteredLevel := styleSheet at:#'menu.enteredLevel' default:0. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
658 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
659 |
ShortcutKeyOffset := 5. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
660 |
DefaultOpenOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
661 |
|
616 | 662 |
Item updateStyleCache |
1018
67c883ab05d6
kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
663 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
664 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
665 |
self updateStyleCache |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
666 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
667 |
|
1130 | 668 |
"Modified: / 10.9.1998 / 21:40:32 / cg" |
388 | 669 |
! ! |
670 |
||
794 | 671 |
!MenuPanel class methodsFor:'image registration'! |
672 |
||
673 |
image:anImage onDevice:aDevice |
|
674 |
" |
|
675 |
Images := nil |
|
676 |
" |
|
1097 | 677 |
|deviceImages image| |
794 | 678 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
679 |
anImage device == aDevice ifTrue:[ |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
680 |
^ anImage |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
681 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
682 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
683 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 684 |
|
1097 | 685 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
686 |
Images at:aDevice put:(deviceImages := Dictionary new) |
1097 | 687 |
]. |
688 |
||
689 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
690 |
^ image |
794 | 691 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
692 |
|
794 | 693 |
image := anImage copy onDevice:aDevice. |
694 |
image clearMaskedPixels. |
|
1097 | 695 |
deviceImages at:anImage put:image. |
794 | 696 |
^ image |
697 |
||
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
698 |
"Modified: / 29.9.1998 / 12:02:41 / cg" |
794 | 699 |
! |
700 |
||
701 |
lightenedImage:anImage onDevice:aDevice |
|
702 |
" |
|
703 |
LigthenedImages := nil |
|
704 |
" |
|
1097 | 705 |
|deviceImages image| |
794 | 706 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
707 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 708 |
|
1097 | 709 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
710 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 711 |
]. |
712 |
||
713 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
714 |
^ image |
794 | 715 |
]. |
716 |
||
717 |
((anImage respondsTo:#colorMap) and:[anImage colorMap notNil]) ifTrue:[ |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
718 |
image := anImage copy lightened onDevice:aDevice. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
719 |
image clearMaskedPixels. |
794 | 720 |
] ifFalse:[ |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
721 |
image := self image:anImage onDevice:aDevice |
794 | 722 |
]. |
1097 | 723 |
deviceImages at:anImage put:image. |
794 | 724 |
^ image |
725 |
||
726 |
||
727 |
! ! |
|
728 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
729 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
730 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
731 |
subMenu:aSubMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
732 |
"create a submenu; can be redifined in derived classes |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
733 |
" |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
734 |
^ (self new) menu:aSubMenu. |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
735 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
736 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
737 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
738 |
|
1808 | 739 |
!MenuPanel methodsFor:'accepting'! |
389 | 740 |
|
741 |
accept |
|
742 |
"accept current selected item |
|
743 |
" |
|
1670 | 744 |
^ self acceptItem:(self selection) inMenu:self |
389 | 745 |
! |
746 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
747 |
accept:anItem |
389 | 748 |
"this is the topMenu: accept item |
749 |
" |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
750 |
|value item tgState itemIdx recv panel masterGroup winGrp acceptAction| |
1630 | 751 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
752 |
self superMenu notNil ifTrue:[ |
1382
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
753 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
754 |
]. |
2016 | 755 |
self scrolling stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
756 |
self selection:nil. |
420 | 757 |
|
758 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
1382
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
759 |
tgState := anItem toggleIndication. |
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
760 |
panel := anItem menuPanel. |
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
761 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
762 |
item := anItem. |
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
763 |
recv := panel receiver. |
389 | 764 |
]. |
1699 | 765 |
self doUngrab:true. |
389 | 766 |
|
510 | 767 |
self isPopUpView ifFalse:[ |
1382
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
768 |
self do:[:el| el updateIndicators]. |
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
769 |
self windowGroup processExposeEvents. |
524 | 770 |
] ifTrue:[ |
1382
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
771 |
self unmap. |
1699 | 772 |
(winGrp := self windowGroup) notNil ifTrue:[ |
773 |
"/ give expose event a chance to arrive |
|
774 |
[shown and:[realized]] whileTrue:[ |
|
775 |
winGrp processExposeEventsFor:self |
|
776 |
]. |
|
777 |
masterGroup := winGrp previousGroup. |
|
1382
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
778 |
]. |
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
779 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
780 |
"/ self destroy. |
1382
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
781 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
524 | 782 |
]. |
1710 | 783 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
784 |
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
|
785 |
|
1710 | 786 |
(item notNil |
787 |
and:[item showBusyCursorWhilePerforming |
|
788 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
789 |
ifTrue:[ |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
790 |
winGrp withWaitCursorDo:acceptAction |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
791 |
] ifFalse:acceptAction. |
524 | 792 |
|
793 |
self isPopUpView ifTrue:[ |
|
1382
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
794 |
self menuAdornmentAt:#value put:value. |
a852ac554869
oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents:
1368
diff
changeset
|
795 |
self menuAdornmentAt:#item put:item. |
524 | 796 |
]. |
1699 | 797 |
^ item. |
524 | 798 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
799 |
"Modified: / 15.11.2001 / 17:05:40 / cg" |
524 | 800 |
! |
801 |
||
802 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
803 |
"accept an item |
|
804 |
" |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
805 |
|value argument numArgs isKindOfValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
806 |
app master fallBack| |
524 | 807 |
|
808 |
anItem isNil ifTrue:[ |
|
2059 | 809 |
self menuAdornmentAt:#hasPerformed put:true. |
810 |
^ nil |
|
524 | 811 |
]. |
812 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
813 |
self menuAdornmentAt:#hasPerformed put:(aReceiver isValueModel). |
524 | 814 |
|
815 |
(value := anItem value) isNil ifTrue:[ |
|
2059 | 816 |
^ anIndex |
524 | 817 |
]. |
818 |
||
819 |
(argument := anItem argument) isNil ifTrue:[ |
|
2059 | 820 |
argument := aState ? anItem |
389 | 821 |
]. |
524 | 822 |
|
823 |
value isSymbol ifFalse:[ |
|
2059 | 824 |
"/ a valueHolder or block |
825 |
(value respondsTo:#valueWithArguments:) ifFalse:[ |
|
826 |
^ value |
|
827 |
]. |
|
828 |
||
829 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
|
830 |
||
831 |
numArgs == 0 ifTrue:[ |
|
832 |
args := nil |
|
833 |
] ifFalse:[ |
|
834 |
numArgs == 1 ifTrue:[ |
|
835 |
args := Array with:argument |
|
836 |
] ifFalse:[ |
|
837 |
args := Array with:argument with:self |
|
838 |
] |
|
839 |
]. |
|
840 |
||
841 |
value valueWithArguments:args. |
|
842 |
||
843 |
self menuAdornmentAt:#hasPerformed put:true. |
|
844 |
^ anIndex |
|
524 | 845 |
]. |
846 |
||
847 |
aReceiver isNil ifTrue:[ |
|
2059 | 848 |
^ value |
524 | 849 |
]. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
850 |
|
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
851 |
isKindOfValueModel := aReceiver isValueModel. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
852 |
isKindOfValueModel ifTrue:[ |
2059 | 853 |
aReceiver value:value |
465 | 854 |
] ifFalse:[ |
2059 | 855 |
rec := aReceiver. |
856 |
arg2 := self. |
|
857 |
||
858 |
"/ support for ST80 style applications |
|
859 |
"/ (expecting the message to go to the application |
|
860 |
"/ if not understood by the view) |
|
861 |
"/ These expect the controller to be passed as argument. |
|
862 |
"/ sigh. |
|
863 |
||
864 |
(aReceiver isView |
|
865 |
and:[(aReceiver respondsTo:value) not |
|
866 |
and:[(app := aReceiver application) ~~ aReceiver |
|
867 |
and:[app notNil]]]) ifTrue:[ |
|
868 |
rec := app. |
|
869 |
arg2 := aReceiver controller "/ the Views controller |
|
870 |
]. |
|
871 |
||
872 |
(numArgs := value numArgs) == 0 ifTrue:[ |
|
873 |
args := nil |
|
874 |
] ifFalse:[ |
|
875 |
numArgs == 1 ifTrue:[ |
|
876 |
args := Array with:argument |
|
877 |
] ifFalse:[ |
|
878 |
args := Array with:argument with:arg2 |
|
879 |
] |
|
880 |
]. |
|
881 |
||
882 |
fallBack := |
|
883 |
[ |
|
884 |
"/ mhmh - the receiver did not respond to that message; |
|
885 |
"/ if there is a master-application, try that one |
|
886 |
"/ (recursive) |
|
887 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
888 |
master notNil ifTrue:[ |
|
889 |
rec := master. |
|
890 |
rec perform:value withArguments:args ifNotUnderstood:fallBack |
|
891 |
] ifFalse:[ |
|
892 |
self |
|
893 |
error:'unimplemented (or error in) menu message: ' , value |
|
894 |
mayProceed:true |
|
895 |
]. |
|
896 |
]. |
|
897 |
||
898 |
rec perform:value withArguments:args ifNotUnderstood:fallBack. |
|
420 | 899 |
]. |
524 | 900 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
901 |
^ value |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
902 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
903 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 904 |
! |
905 |
||
1670 | 906 |
acceptItem:anItem inMenu:aMenu |
907 |
|tgState| |
|
908 |
||
1841 | 909 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
1670 | 910 |
self topMenu accept:anItem |
911 |
] ifFalse:[ |
|
912 |
anItem canAccept ifTrue:[ |
|
913 |
tgState := anItem toggleIndication. |
|
914 |
||
915 |
self accept:anItem |
|
916 |
index:(aMenu selectionIndex) |
|
917 |
toggle:tgState |
|
918 |
receiver:(aMenu receiver). |
|
919 |
||
920 |
aMenu do:[:el| el updateIndicators]. |
|
921 |
] |
|
922 |
] |
|
923 |
! |
|
924 |
||
389 | 925 |
lastItemAccepted |
926 |
"returns last item selected or nil |
|
927 |
" |
|
390 | 928 |
^ self topMenu menuAdornmentAt:#item |
389 | 929 |
! |
930 |
||
931 |
lastValueAccepted |
|
932 |
"returns last value accepted or nil |
|
933 |
" |
|
971 | 934 |
^ (self lastItemAccepted) value |
935 |
"/ |top| |
|
936 |
"/ |
|
937 |
"/ top := self topMenu. |
|
938 |
"/ |
|
939 |
"/ (top menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
|
940 |
"/ ^ self topMenu menuAdornmentAt:#value. |
|
941 |
"/ ]. |
|
942 |
"/ ^ nil |
|
943 |
||
944 |
"Modified: / 18.6.1998 / 23:37:09 / cg" |
|
389 | 945 |
! ! |
946 |
||
388 | 947 |
!MenuPanel methodsFor:'accessing'! |
948 |
||
949 |
accessCharacterPositionAt:stringOrNumber |
|
390 | 950 |
"get the access character position for a textLabel |
388 | 951 |
" |
2059 | 952 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 953 |
! |
954 |
||
955 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
390 | 956 |
"get the access character position for a textLabel |
388 | 957 |
" |
958 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
|
959 |
! |
|
960 |
||
961 |
accessCharacterPositions |
|
962 |
"returns a collection of accessCharacterPosition's or nil |
|
963 |
" |
|
964 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
|
965 |
||
966 |
! |
|
967 |
||
968 |
accessCharacterPositions:something |
|
969 |
"define accessCharacterPosition's for each item |
|
970 |
" |
|
971 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
|
972 |
! |
|
973 |
||
974 |
args |
|
975 |
"returns a collection of argument's or nil |
|
976 |
" |
|
977 |
^ self collect:[:anItem| anItem argument ] |
|
978 |
! |
|
979 |
||
980 |
args:something |
|
981 |
"define arguments for each item |
|
982 |
" |
|
983 |
self onEachPerform:#argument: withArgList:something |
|
984 |
! |
|
985 |
||
986 |
argsAt:stringOrNumber |
|
987 |
"gets the argument of an item or nil |
|
988 |
" |
|
2059 | 989 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 990 |
! |
991 |
||
992 |
argsAt:stringOrNumber put:anArgument |
|
993 |
"sets the argument of an item |
|
994 |
" |
|
995 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
|
996 |
! |
|
997 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
998 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
999 |
"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
|
1000 |
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
|
1001 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1002 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1003 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1004 |
"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
|
1005 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1006 |
|
388 | 1007 |
groupSizes |
1008 |
"gets collection of group sizes |
|
1009 |
" |
|
1010 |
^ groupSizes |
|
1011 |
! |
|
1012 |
||
1013 |
groupSizes:aGroupSizes |
|
1014 |
"sets collection of group sizes |
|
1015 |
" |
|
1016 |
aGroupSizes = groupSizes ifFalse:[ |
|
1117 | 1017 |
groupSizes := aGroupSizes copy. |
1018 |
self mustRearrange. |
|
388 | 1019 |
]. |
1020 |
! |
|
1021 |
||
1022 |
labelAt:stringOrNumber |
|
1023 |
"gets the label of an item or nil |
|
1024 |
" |
|
1025 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
|
1026 |
! |
|
1027 |
||
1028 |
labelAt:stringOrNumber put:aLabel |
|
1029 |
"sets the label of an item |
|
1030 |
" |
|
1031 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
|
1032 |
! |
|
1033 |
||
1034 |
labels |
|
1035 |
"returns a collection of labels's or nil |
|
1036 |
" |
|
1037 |
^ self collect:[:anItem| anItem label ] |
|
1038 |
||
1039 |
! |
|
1040 |
||
1041 |
labels:labels |
|
1042 |
"define labels for each item |
|
1043 |
" |
|
1044 |
self disabledRedrawDo:[ |
|
1117 | 1045 |
self removeAll. |
1046 |
||
1047 |
labels notNil ifTrue:[ |
|
1048 |
labels do:[:aLabel|(self createAtIndex:nil) label:aLabel] |
|
1049 |
] |
|
388 | 1050 |
] |
1051 |
! |
|
1052 |
||
1999 | 1053 |
menuPerformer:anObject |
1054 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1055 |
from all submenus no specific receiver is defined ). |
|
1056 |
" |
|
1057 |
^ self receiver:anObject |
|
1058 |
! |
|
1059 |
||
388 | 1060 |
nameKeyAt:stringOrNumber |
1061 |
"gets the nameKey of an item or nil |
|
1062 |
" |
|
1063 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
1064 |
! |
|
1065 |
||
1066 |
nameKeyAt:stringOrNumber put:aNameKey |
|
1067 |
"sets the nameKey of an item |
|
1068 |
" |
|
1069 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
|
1070 |
! |
|
1071 |
||
1072 |
nameKeys |
|
1073 |
"returns a collection of nameKeys's or nil |
|
1074 |
" |
|
1075 |
^ self collect:[:anItem| anItem nameKey ] |
|
1076 |
! |
|
1077 |
||
1078 |
nameKeys:something |
|
1079 |
"define nameKeys for each item |
|
1080 |
" |
|
1081 |
self onEachPerform:#nameKey: withArgList:something |
|
1082 |
! |
|
1083 |
||
1084 |
numberOfItems |
|
1085 |
"gets number of items |
|
1086 |
" |
|
1087 |
^ items size |
|
1088 |
! |
|
1089 |
||
1090 |
receiver |
|
1091 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1092 |
from all submenus no specific receiver is defined ). |
|
1093 |
" |
|
389 | 1094 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
1117 | 1095 |
^ superMenu receiver |
388 | 1096 |
]. |
389 | 1097 |
^ receiver |
388 | 1098 |
! |
1099 |
||
1100 |
receiver:anObject |
|
1101 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1102 |
from all submenus no specific receiver is defined ). |
|
1103 |
" |
|
389 | 1104 |
receiver := anObject |
388 | 1105 |
! |
1106 |
||
1107 |
shortcutKeyAt:stringOrNumber |
|
1108 |
"gets the shortCutKey of an item or nil |
|
1109 |
" |
|
1110 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
1111 |
! |
|
1112 |
||
1113 |
shortcutKeyAt:stringOrNumber put:aKey |
|
1114 |
"sets the shortCutKey of an item |
|
1115 |
" |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1116 |
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
|
1117 |
! |
388 | 1118 |
|
1119 |
shortcutKeys |
|
1120 |
"returns a collection of shortcutKey's or nil |
|
1121 |
" |
|
1122 |
^ self collect:[:anItem| anItem shortcutKey ] |
|
1123 |
||
1124 |
! |
|
1125 |
||
1126 |
shortcutKeys:something |
|
1127 |
"define shortcutKey's for each item |
|
1128 |
" |
|
1129 |
self onEachPerform:#shortcutKey: withArgList:something |
|
1130 |
! |
|
1131 |
||
1132 |
valueAt:stringOrNumber |
|
1133 |
"gets value of an item; a block, valueHolder, ... |
|
1134 |
" |
|
1135 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
1136 |
||
1137 |
! |
|
1138 |
||
1139 |
valueAt:stringOrNumber put:someThing |
|
1140 |
"sets value of an item; a block, valueHolder, ... |
|
1141 |
" |
|
1142 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
|
1143 |
||
1144 |
||
1145 |
! |
|
1146 |
||
1147 |
values:something |
|
1148 |
"define values for each item |
|
1149 |
" |
|
1150 |
self onEachPerform:#value: withArgList:something |
|
1151 |
! ! |
|
1152 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1153 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1154 |
|
1155 |
disableAll |
|
498 | 1156 |
"disable all items; not the menu in case of enabled |
388 | 1157 |
" |
498 | 1158 |
self do:[:anItem| anItem enabled:false] |
388 | 1159 |
! |
1160 |
||
1161 |
disableAll:collectionOfIndicesOrNames |
|
1162 |
"disable an collection of items |
|
1163 |
" |
|
1164 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
|
1165 |
||
1166 |
! |
|
1167 |
||
1168 |
enableAll |
|
498 | 1169 |
"enable all items; not the menu in case of disabled |
388 | 1170 |
" |
498 | 1171 |
self do:[:anItem| anItem enabled:true] |
388 | 1172 |
! |
1173 |
||
1174 |
enableAll:collectionOfIndicesOrNames |
|
1175 |
"enable an collection of items |
|
1176 |
" |
|
1177 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
|
1178 |
||
1179 |
! |
|
1180 |
||
1181 |
enabled |
|
1182 |
"returns enabled state |
|
1183 |
" |
|
498 | 1184 |
^ enabled |
388 | 1185 |
! |
1186 |
||
1187 |
enabled:aState |
|
1188 |
"change enabled state of menu |
|
1189 |
" |
|
545 | 1190 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1191 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1192 |
state := aState ? true. |
388 | 1193 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1194 |
enabled ~~ state ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1195 |
enabled := state. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1196 |
self invalidate. |
498 | 1197 |
]. |
388 | 1198 |
! |
1199 |
||
1200 |
enabledAt:stringOrNumber |
|
1201 |
"gets the enabled state of an item or false |
|
1202 |
" |
|
1203 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
|
1204 |
! |
|
1205 |
||
1206 |
enabledAt:stringOrNumber put:aState |
|
1207 |
"sets the enabled state of an item |
|
1208 |
" |
|
1209 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
|
1210 |
! |
|
1211 |
||
1212 |
isEnabled:stringOrNumber |
|
1213 |
"gets the enabled state of an item or false |
|
1214 |
" |
|
1215 |
^ self enabledAt:stringOrNumber |
|
1216 |
! ! |
|
1217 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1218 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1219 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1220 |
enableChannel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1221 |
"gets a enable channel or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1222 |
" |
498 | 1223 |
^ enableChannel |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1224 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1225 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1226 |
enableChannel:aValueHolder |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1227 |
"set my enableChannel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1228 |
" |
498 | 1229 |
enableChannel notNil ifTrue:[ |
1117 | 1230 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1231 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1232 |
|
498 | 1233 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
1117 | 1234 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1235 |
]. |
498 | 1236 |
self enabled:(enableChannel value). |
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 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1239 |
menuHolder |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1240 |
"gets a menu holder or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1241 |
" |
498 | 1242 |
^ menuHolder |
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 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1245 |
menuHolder:aValueHolder |
498 | 1246 |
"set my menuHolder |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1247 |
" |
498 | 1248 |
menuHolder notNil ifTrue:[ |
1117 | 1249 |
menuHolder removeDependent:self |
407
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 |
|
498 | 1252 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
1117 | 1253 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1254 |
]. |
498 | 1255 |
self menu:(menuHolder value) |
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 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1258 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1259 |
|
616 | 1260 |
activeBackgroundColor |
1261 |
"get the background drawing color used to highlight selection |
|
1262 |
" |
|
1263 |
^ activeBgColor |
|
1264 |
! |
|
1265 |
||
1266 |
activeForegroundColor |
|
1267 |
"get the foreground color used to highlight selections |
|
1268 |
" |
|
1269 |
^ activeFgColor |
|
1270 |
! |
|
1271 |
||
390 | 1272 |
backgroundColor |
1273 |
"return the background color |
|
1274 |
" |
|
502 | 1275 |
^ super viewBackground |
390 | 1276 |
! |
1277 |
||
1278 |
backgroundColor:aColor |
|
1279 |
"set the background drawing color. You should not use this method; |
|
1280 |
instead leave the value as defined in the styleSheet. |
|
1281 |
" |
|
616 | 1282 |
super viewBackground ~~ aColor ifTrue:[ |
1117 | 1283 |
super viewBackground:aColor. |
1284 |
shown ifTrue:[ |
|
1285 |
self invalidate "/ RepairNow:true |
|
1286 |
] |
|
616 | 1287 |
] |
1288 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1289 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1290 |
! |
1291 |
||
727 | 1292 |
buttonActiveBackgroundColor |
1293 |
"get the background drawing color used to highlight button selection |
|
1294 |
" |
|
2059 | 1295 |
^ ButtonActiveBackgroundColor |
727 | 1296 |
! |
1297 |
||
730 | 1298 |
buttonEdgeStyle |
1299 |
"get the button edge style |
|
1300 |
" |
|
2059 | 1301 |
^ ButtonEdgeStyle |
730 | 1302 |
! |
1303 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1304 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1305 |
"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
|
1306 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1307 |
^ buttonEnteredBgColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1308 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1309 |
"Created: / 20.8.1998 / 13:53:37 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1310 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1311 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1312 |
buttonEnteredLevel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1313 |
"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
|
1314 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1315 |
^ ButtonEnteredLevel |
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 |
"Created: / 20.8.1998 / 13:53:46 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1318 |
"Modified: / 20.8.1998 / 15:49:32 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1319 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1320 |
|
730 | 1321 |
buttonHalfLightColor |
1322 |
"get the background drawing color used to half light button frame |
|
1323 |
" |
|
2059 | 1324 |
^ buttonHalfLightColor |
730 | 1325 |
! |
1326 |
||
1327 |
buttonHalfShadowColor |
|
1328 |
"get the background drawing color used to half shadow button frame |
|
1329 |
" |
|
2059 | 1330 |
^ buttonHalfShadowColor |
727 | 1331 |
! |
1332 |
||
1333 |
buttonLightColor |
|
1334 |
"get the background drawing color used to light button frame |
|
1335 |
" |
|
2059 | 1336 |
^ buttonLightColor |
727 | 1337 |
! |
1338 |
||
1339 |
buttonPassiveBackgroundColor |
|
1340 |
"get the background drawing color used for button |
|
1341 |
" |
|
2059 | 1342 |
^ ButtonPassiveBackgroundColor |
727 | 1343 |
! |
1344 |
||
1345 |
buttonShadowColor |
|
1346 |
"get the background drawing color used to shadow button frame |
|
1347 |
" |
|
2059 | 1348 |
^ buttonShadowColor |
1349 |
! |
|
1350 |
||
1351 |
disabledEtchedForegroundColor |
|
1352 |
"return the color used for etching disabled items. |
|
1353 |
If nil, no 3D effect is drawn. |
|
1354 |
" |
|
1355 |
^ disabledEtchedFgColor |
|
727 | 1356 |
! |
1357 |
||
390 | 1358 |
disabledForegroundColor |
1359 |
"return the foreground color used by disabled items |
|
1360 |
" |
|
2059 | 1361 |
^ disabledFgColor |
390 | 1362 |
! |
1363 |
||
1364 |
font:aFont |
|
1365 |
"set the font |
|
1366 |
" |
|
829 | 1367 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
1478 | 1368 |
super font:(aFont onDevice:device). |
1369 |
||
1370 |
superMenu notNil ifTrue:[ |
|
1371 |
self extent:(self preferredExtent) |
|
1372 |
]. |
|
1373 |
self mustRearrange. |
|
390 | 1374 |
] |
1375 |
! |
|
1376 |
||
1377 |
foregroundColor |
|
1378 |
"return the passive foreground color |
|
1379 |
" |
|
2059 | 1380 |
^ fgColor |
390 | 1381 |
! |
1382 |
||
1383 |
foregroundColor:aColor |
|
1384 |
"set the foregroundColor drawing color. You should not use this method; |
|
1385 |
instead leave the value as defined in the styleSheet. |
|
1386 |
" |
|
616 | 1387 |
fgColor ~~ aColor ifTrue:[ |
1478 | 1388 |
fgColor := aColor onDevice:device. |
1389 |
shown ifTrue:[ |
|
1390 |
self invalidate "/ RepairNow:true |
|
1391 |
] |
|
616 | 1392 |
] |
1393 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1394 |
"Modified: / 6.6.1998 / 19:50:46 / cg" |
580 | 1395 |
! |
1396 |
||
390 | 1397 |
lightColor |
1398 |
"get the lightColor |
|
1399 |
" |
|
1400 |
^ lightColor |
|
1401 |
||
1402 |
||
1403 |
! |
|
1404 |
||
1699 | 1405 |
maxAbsoluteButtonLevel |
1406 |
"returns the maximum absolute button level; used to compute the preferred |
|
1407 |
extent of a button |
|
1408 |
" |
|
1409 |
|level| |
|
1410 |
||
1411 |
level := (ButtonActiveLevel abs) max:(ButtonEnteredLevel abs). |
|
2059 | 1412 |
^ level max:(ButtonPassiveLevel abs) |
390 | 1413 |
! |
1414 |
||
730 | 1415 |
selectionFrameBrightColor |
1416 |
"get the selection frame bright color |
|
1417 |
" |
|
2059 | 1418 |
^ selectionFrameBrightColor |
730 | 1419 |
! |
1420 |
||
1421 |
selectionFrameDarkColor |
|
1422 |
"get the selection frame dark color |
|
1423 |
" |
|
2059 | 1424 |
^ selectionFrameDarkColor |
730 | 1425 |
! |
1426 |
||
1727 | 1427 |
setFont:aFont |
1428 |
"set the font derived from item; if unchanged nil is returned otherwise the old font |
|
1429 |
" |
|
1430 |
|currentFont| |
|
1431 |
||
1432 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
1433 |
currentFont := font. |
|
1434 |
super font:aFont. |
|
1435 |
]. |
|
1436 |
^ currentFont |
|
1437 |
! |
|
1438 |
||
390 | 1439 |
shadowColor |
1440 |
"get the shadowColor |
|
1441 |
" |
|
1442 |
^ shadowColor |
|
1443 |
||
1444 |
||
1445 |
! ! |
|
1446 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1447 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1448 |
|
1449 |
height |
|
1450 |
"default height |
|
1451 |
" |
|
1452 |
(explicitExtent ~~ true) ifTrue:[ |
|
1699 | 1453 |
^ self preferredExtent y |
388 | 1454 |
]. |
1455 |
^ super height |
|
1456 |
! |
|
1457 |
||
2016 | 1458 |
maxExtent |
1459 |
"CLAUS: returns the maximum extent |
|
1460 |
" |
|
1461 |
|x y| |
|
1462 |
||
1463 |
device isNil ifTrue:[ |
|
1464 |
superMenu notNil ifTrue:[ |
|
1465 |
^ superMenu maxExtent |
|
1466 |
]. |
|
1467 |
]. |
|
1468 |
y := device usableHeight - 2. |
|
1469 |
x := device usableWidth - 2. |
|
1470 |
^ x@y |
|
1471 |
! |
|
1472 |
||
388 | 1473 |
preferredExtent |
1474 |
"compute and returns my preferred extent |
|
2016 | 1475 |
" |
2024 | 1476 |
|maxExtent usedExtent w| |
1477 |
||
2016 | 1478 |
preferredExtent notNil ifTrue:[ |
1479 |
^ preferredExtent |
|
1480 |
]. |
|
2024 | 1481 |
maxExtent := self maxExtent. |
1482 |
usedExtent := self preferredExtentOfItems. |
|
1483 |
||
1484 |
superView isNil ifTrue:[ |
|
1485 |
"/ is standalone |
|
1486 |
w := self menuAdornmentAt:#Width. |
|
1487 |
||
1488 |
w notNil ifTrue:[ |
|
1489 |
usedExtent x < w ifTrue:[ |
|
1490 |
usedExtent := w @ usedExtent y. |
|
1491 |
] |
|
1492 |
] |
|
1493 |
]. |
|
1494 |
||
1495 |
^ usedExtent min:maxExtent |
|
1496 |
||
1497 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1498 |
! |
1499 |
||
1500 |
preferredExtentOfItems |
|
1501 |
"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
|
1502 |
!!!!!! changes have influence on method #rearrangeItems !!!!!! |
388 | 1503 |
" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1504 |
|hasMenu shCtKey extent showAcc sck |
1699 | 1505 |
x "{ Class:SmallInteger }" |
1506 |
y "{ Class:SmallInteger }" |
|
1507 |
size "{ Class:SmallInteger }" |
|
1508 |
buttonInset "{ Class:SmallInteger }" |
|
1509 |
labelInset "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1510 |
| |
388 | 1511 |
|
1699 | 1512 |
(size := items size) == 0 ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1513 |
^ 32 @ 32 |
388 | 1514 |
]. |
1699 | 1515 |
buttonInset := 2 * (DefaultButtonItemSpace abs). |
1516 |
||
1517 |
self isPopUpView ifFalse:[ |
|
1518 |
labelInset := 2 * (DefaultEnteredLevel abs). |
|
1519 |
] ifTrue:[ |
|
1520 |
labelInset := 0. |
|
1521 |
]. |
|
1522 |
||
1523 |
x := 0. |
|
1524 |
y := 0. |
|
388 | 1525 |
|
1526 |
self verticalLayout ifFalse:[ |
|
1699 | 1527 |
"/ HORIZONTAL LAYOUT |
1528 |
||
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:[ |
1699 | 1537 |
eX := eX + buttonInset. |
1538 |
eY := eY + buttonInset. |
|
1539 |
] ifFalse:[ |
|
1540 |
eX := eX + labelInset. |
|
1541 |
eY := eY + labelInset. |
|
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:[ |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1547 |
el isLabeledItem ifTrue:[ |
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. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1562 |
|
1699 | 1563 |
items keysAndValuesDo:[:key :el| |eX eY| |
1564 |
extent := el preferredExtent. |
|
1565 |
||
1566 |
"/ check for visibility (extent x ~~ 0) |
|
1567 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1568 |
eY := extent y. |
|
1569 |
||
1570 |
el isButton ifTrue:[ |
|
1571 |
eX := eX + buttonInset. |
|
1572 |
eY := eY + buttonInset. |
|
1573 |
] ifFalse:[ |
|
1574 |
eX := eX + labelInset. |
|
1575 |
eY := eY + labelInset. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1576 |
]. |
1699 | 1577 |
hasMenu ifFalse:[ |
1578 |
hasMenu := el hasSubmenu |
|
1579 |
]. |
|
1580 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1581 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1582 |
]. |
|
1583 |
key ~~ size ifTrue:[ |
|
1584 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1585 |
y := y + groupDividerSize |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1586 |
"/ ] ifFalse:[ |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1587 |
"/ y := y + itemSpace |
1699 | 1588 |
] |
1589 |
]. |
|
1590 |
y := eY + y. |
|
1591 |
x := eX max:x. |
|
1592 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1593 |
]. |
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:[ |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1600 |
x := x + 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 |
||
1610 |
^ x @ y |
|
388 | 1611 |
! |
1612 |
||
2024 | 1613 |
preferredWidth:aWidth |
1614 |
self menuAdornmentAt:#Width put:aWidth. |
|
1615 |
||
1616 |
"Created: / 10.10.2001 / 14:56:39 / cg" |
|
1617 |
! |
|
1618 |
||
388 | 1619 |
shortKeyInset |
1620 |
"left inset of shortcutKey |
|
1621 |
" |
|
1622 |
^ shortKeyInset |
|
616 | 1623 |
! |
1624 |
||
1625 |
subMenuIndicationWidth |
|
1626 |
^ RightArrowForm width |
|
388 | 1627 |
! ! |
1628 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1629 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1630 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1631 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1632 |
iconIndicationDisabledOff isNil ifTrue:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1633 |
superMenu notNil ifTrue:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1634 |
iconIndicationDisabledOff := superMenu iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1635 |
] ifFalse:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1636 |
iconIndicationDisabledOff := self registerImageOnDevice:(self class iconIndicationDisabledOff) |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1637 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1638 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1639 |
^ iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1640 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1641 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1642 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1643 |
iconIndicationDisabledOn isNil ifTrue:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1644 |
superMenu notNil ifTrue:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1645 |
iconIndicationDisabledOn := superMenu iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1646 |
] ifFalse:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1647 |
iconIndicationDisabledOn := self registerImageOnDevice:(self class iconIndicationDisabledOn) |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1648 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1649 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1650 |
^ iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1651 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1652 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1653 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1654 |
iconIndicationOff isNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1655 |
superMenu notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1656 |
iconIndicationOff := superMenu iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1657 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1658 |
iconIndicationOff := self registerImageOnDevice:(self class iconIndicationOff) |
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 |
^ iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1662 |
! |
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 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1665 |
iconIndicationOn isNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1666 |
superMenu notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1667 |
iconIndicationOn := superMenu iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1668 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1669 |
iconIndicationOn := self registerImageOnDevice:(self class iconIndicationOn) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1670 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1671 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1672 |
^ iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1673 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1674 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1675 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1676 |
iconRadioGroupDisabledOff isNil ifTrue:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1677 |
superMenu notNil ifTrue:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1678 |
iconRadioGroupDisabledOff := superMenu iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1679 |
] ifFalse:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1680 |
iconRadioGroupDisabledOff := self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1681 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1682 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1683 |
^ iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1684 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1685 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1686 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1687 |
iconRadioGroupDisabledOn isNil ifTrue:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1688 |
superMenu notNil ifTrue:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1689 |
iconRadioGroupDisabledOn := superMenu iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1690 |
] ifFalse:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1691 |
iconRadioGroupDisabledOn := self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1692 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1693 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1694 |
^ iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1695 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1696 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1697 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1698 |
iconRadioGroupOff isNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1699 |
superMenu notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1700 |
iconRadioGroupOff := superMenu iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1701 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1702 |
iconRadioGroupOff := self registerImageOnDevice:(self class iconRadioGroupOff) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1703 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1704 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1705 |
^ iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1706 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1707 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1708 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1709 |
iconRadioGroupOn isNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1710 |
superMenu notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1711 |
iconRadioGroupOn := superMenu iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1712 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1713 |
iconRadioGroupOn := self registerImageOnDevice:(self class iconRadioGroupOn) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1714 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1715 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1716 |
^ iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1717 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1718 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1719 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1720 |
|
1721 |
itemAt:stringOrNumber |
|
390 | 1722 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
1723 |
If no item match nil is returned. |
|
388 | 1724 |
" |
1725 |
|idx| |
|
1726 |
||
1727 |
idx := self indexOf:stringOrNumber. |
|
1728 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
|
1729 |
^ nil |
|
1730 |
||
1731 |
! |
|
1732 |
||
1733 |
itemAt:stringOrNumber do:aOneArgBlock |
|
1734 |
"evaluate teh block for an item and return the result from the block. In case that |
|
1735 |
the item not exists nil is returned |
|
1736 |
" |
|
1737 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
|
1738 |
! |
|
1739 |
||
1740 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1741 |
"evaluate teh block for an item and return the result from the block. In case that |
|
1742 |
the item not exists the result of the exception block is returned (no arguments). |
|
1743 |
" |
|
1744 |
|item| |
|
1745 |
||
1746 |
item := self itemAt:stringOrNumber. |
|
1747 |
item notNil ifTrue:[ ^ aOneArgBlock value:item ]. |
|
1748 |
^ exceptionBlock value |
|
706 | 1749 |
! |
1750 |
||
1751 |
itemAtIndex:anIndex |
|
1752 |
"returns item at an index or nil |
|
1753 |
" |
|
1754 |
^ 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
|
1755 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1756 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1757 |
items |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1758 |
"returns list of items or nil |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1759 |
" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1760 |
^ items |
388 | 1761 |
! ! |
1762 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1763 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1764 |
|
727 | 1765 |
buttonActiveLevel |
1766 |
"get the button active level |
|
1767 |
" |
|
2059 | 1768 |
^ ButtonActiveLevel |
727 | 1769 |
! |
1770 |
||
1771 |
buttonPassiveLevel |
|
1772 |
"get the button passive level |
|
1773 |
" |
|
2059 | 1774 |
^ ButtonPassiveLevel |
727 | 1775 |
! |
1776 |
||
390 | 1777 |
fitFirstPanel |
1778 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1779 |
to the extent of its superView |
|
1699 | 1780 |
|
1781 |
NOT SUPPORTED |
|
388 | 1782 |
" |
616 | 1783 |
^ fitFirstPanel |
388 | 1784 |
! |
1785 |
||
390 | 1786 |
fitFirstPanel:aState |
1787 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1788 |
to the extent of its superView |
|
1699 | 1789 |
|
1790 |
NOT SUPPORTED |
|
1791 |
" |
|
1792 |
fitFirstPanel := aState. |
|
388 | 1793 |
! |
1794 |
||
390 | 1795 |
groupDividerSize |
1796 |
"get the size of the group dividers |
|
388 | 1797 |
" |
616 | 1798 |
^ groupDividerSize |
1799 |
||
388 | 1800 |
! |
1801 |
||
390 | 1802 |
groupDividerSize:aSize |
616 | 1803 |
"set the size of the group dividers. You should not use this |
1804 |
method; instead leave the value as defined in the styleSheet. |
|
388 | 1805 |
" |
616 | 1806 |
aSize ~~ groupDividerSize ifTrue:[ |
1117 | 1807 |
groupDividerSize := aSize. |
1808 |
self mustRearrange. |
|
616 | 1809 |
]. |
1810 |
||
388 | 1811 |
! |
1812 |
||
616 | 1813 |
itemSpace |
1814 |
"get the space space between to items |
|
388 | 1815 |
" |
616 | 1816 |
^ itemSpace |
1817 |
||
388 | 1818 |
! |
1819 |
||
616 | 1820 |
itemSpace:aSize |
1821 |
"set the horizontal space between to items. You should not use this |
|
1822 |
method; instead leave the value as defined in the styleSheet. |
|
388 | 1823 |
" |
616 | 1824 |
aSize ~~ itemSpace ifTrue:[ |
1117 | 1825 |
itemSpace := aSize. |
1826 |
self mustRearrange |
|
616 | 1827 |
]. |
1828 |
||
1829 |
! |
|
1830 |
||
1093 | 1831 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1832 |
anInt ~~ level ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1833 |
super level:anInt. |
2052 | 1834 |
self mustRearrange |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1835 |
] |
2052 | 1836 |
|
1837 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1838 |
! |
1839 |
||
616 | 1840 |
rightArrow |
1841 |
^ rightArrow |
|
1842 |
! |
|
1843 |
||
1844 |
rightArrowShadow |
|
1845 |
^ rightArrowShadow |
|
388 | 1846 |
! |
1847 |
||
390 | 1848 |
showGroupDivider |
1849 |
"get the enabled flag for showing groupDiveders |
|
388 | 1850 |
" |
1222 | 1851 |
^ (self menuAdornmentAt:#showGroupDivider) |
388 | 1852 |
! |
1853 |
||
390 | 1854 |
showGroupDivider:aState |
1855 |
"set the enabled flag for showing groupDiveders |
|
388 | 1856 |
" |
653 | 1857 |
(self menuAdornmentAt:#showGroupDivider put:aState) ifTrue:[ |
1117 | 1858 |
self mustRearrange. |
653 | 1859 |
] |
388 | 1860 |
! |
1861 |
||
1862 |
showSeparatingLines |
|
1863 |
"gets true if drawing of separating lines is enabled. |
|
1864 |
" |
|
1222 | 1865 |
^ (self menuAdornmentAt:#showSeparatingLines) |
388 | 1866 |
! |
1867 |
||
390 | 1868 |
showSeparatingLines:aState |
388 | 1869 |
"turn on/off drawing of separating lines. |
1870 |
" |
|
653 | 1871 |
(self menuAdornmentAt:#showSeparatingLines put:aState) ifTrue:[ |
1117 | 1872 |
self mustRearrange |
653 | 1873 |
] |
388 | 1874 |
! |
1875 |
||
1876 |
verticalLayout |
|
1877 |
"get the layout: or vertical( true ) or horizontal( false ) |
|
1878 |
" |
|
1824 | 1879 |
|direction| |
1880 |
||
1881 |
direction := self menuAdornmentAt:#verticalLayout. |
|
1882 |
^ direction notNil ifTrue:[direction] ifFalse:[superMenu notNil] |
|
388 | 1883 |
! |
1884 |
||
1885 |
verticalLayout:aState |
|
1886 |
"set the layout: or vertical( true ) or horizontal( false ) |
|
1887 |
" |
|
653 | 1888 |
(self menuAdornmentAt:#verticalLayout put:aState) ifTrue:[ |
1117 | 1889 |
self mustRearrange |
653 | 1890 |
] |
388 | 1891 |
! ! |
1892 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1893 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 1894 |
|
1895 |
subMenuAt:stringOrNumber |
|
1896 |
"gets the submenu of an item or nil |
|
1897 |
" |
|
1898 |
^ self itemAt:stringOrNumber do:[:el| el submenu ] |
|
1899 |
! |
|
1900 |
||
1901 |
subMenuAt:stringOrNumber put:aSubMenu |
|
1902 |
"sets the submenu of an item |
|
1903 |
" |
|
1904 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
|
1905 |
||
1906 |
! |
|
1907 |
||
1908 |
subMenuShown |
|
1909 |
"return the currently visible submenu - or nil if there is none |
|
1910 |
" |
|
1911 |
|item| |
|
1912 |
||
1913 |
(item := self selection) notNil ifTrue:[ |
|
1117 | 1914 |
^ item submenu |
388 | 1915 |
]. |
1916 |
^ nil |
|
1917 |
! ! |
|
1918 |
||
1698 | 1919 |
!MenuPanel methodsFor:'activation / deactivation'! |
388 | 1920 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1921 |
closeMenus |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1922 |
"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
|
1923 |
" |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1924 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1925 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1926 |
|
388 | 1927 |
hide |
1928 |
"hide the view, leave its modal event loop |
|
1929 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1930 |
|
388 | 1931 |
self selection:nil. |
1932 |
self unmap. |
|
1933 |
||
1934 |
||
1935 |
! |
|
1936 |
||
1937 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1938 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1939 |
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
|
1940 |
(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
|
1941 |
to some performer) |
388 | 1942 |
" |
1943 |
^ self showAt:(self origin) resizing:true |
|
1944 |
||
1945 |
! |
|
1946 |
||
1947 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1948 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1949 |
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
|
1950 |
(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
|
1951 |
to some performer) |
388 | 1952 |
" |
1953 |
^ self showAt:aPoint resizing:true |
|
1954 |
||
1955 |
||
1956 |
! |
|
1957 |
||
1958 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1959 |
"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
|
1960 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1961 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1962 |
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
|
1963 |
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
|
1964 |
if a non-nil is returned. |
388 | 1965 |
" |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1966 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1967 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 1968 |
|
1969 |
aBoolean ifTrue:[ |
|
1459 | 1970 |
self fixSize. |
388 | 1971 |
]. |
1972 |
self origin:aPoint. |
|
1459 | 1973 |
"/ self makeFullyVisible. -- done in realize |
388 | 1974 |
self openModal:[true]. "realize " |
1975 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1976 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1977 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1978 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1979 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
1459 | 1980 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1981 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1982 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1983 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1984 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1985 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 1986 |
! |
1987 |
||
1988 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1989 |
"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
|
1990 |
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
|
1991 |
(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
|
1992 |
to some performer) |
388 | 1993 |
" |
1994 |
^ self showAt:(device pointerPosition) resizing:true |
|
1995 |
||
1996 |
||
1997 |
! |
|
1998 |
||
1999 |
showCenteredIn:aView |
|
2000 |
"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
|
2001 |
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
|
2002 |
(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
|
2003 |
to some performer) |
388 | 2004 |
" |
2005 |
|top| |
|
2006 |
||
2007 |
top := aView topView. |
|
2008 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2009 |
^ 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
|
2010 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2011 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2012 |
! |
2013 |
||
2014 |
startUp |
|
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) |
388 | 2019 |
" |
2020 |
^ self showAtPointer |
|
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2021 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2022 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2023 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2024 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2025 |
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
|
2026 |
(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
|
2027 |
to some performer) |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2028 |
" |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2029 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2030 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2031 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2032 |
! |
2033 |
||
2034 |
startUpOrNil |
|
2035 |
"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
|
2036 |
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
|
2037 |
(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
|
2038 |
to some performer) |
1750 | 2039 |
" |
2040 |
^ self showAtPointer |
|
388 | 2041 |
! ! |
2042 |
||
2043 |
!MenuPanel methodsFor:'adding & removing'! |
|
2044 |
||
2045 |
createAtIndex:anIndexOrNil |
|
1800 | 2046 |
"create an item and add this item to the index. In case of nil, the item |
2047 |
is added to the end. If the index is not valid nil is returned; |
|
2048 |
otherwise the new created item is returned. |
|
388 | 2049 |
" |
2050 |
|max item| |
|
2051 |
||
2052 |
max := (items size) + 1. |
|
2053 |
||
2054 |
anIndexOrNil notNil ifTrue:[ |
|
1800 | 2055 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2056 |
^ nil |
|
2057 |
] |
|
388 | 2058 |
]. |
2059 |
items isNil ifTrue:[ |
|
1800 | 2060 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2061 |
] ifFalse:[ |
1800 | 2062 |
items := items asOrderedCollection |
388 | 2063 |
]. |
2064 |
item := Item in:self. |
|
2065 |
||
2066 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
1800 | 2067 |
items add:item |
388 | 2068 |
] ifFalse:[ |
1800 | 2069 |
items add:item beforeIndex:anIndexOrNil |
388 | 2070 |
]. |
2071 |
^ item |
|
2072 |
! |
|
2073 |
||
2074 |
remove:stringOrNumber |
|
2075 |
"remove the first item which is assigned to stringOrNumber; |
|
2076 |
if found, remove and return it |
|
2077 |
" |
|
2078 |
|item| |
|
2079 |
||
2080 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
1117 | 2081 |
items remove:item. |
2082 |
item destroy. |
|
2083 |
items isEmpty ifTrue:[items := nil]. |
|
2084 |
self mustRearrange. |
|
388 | 2085 |
]. |
2086 |
^ item |
|
2087 |
! |
|
2088 |
||
2089 |
removeAll |
|
2090 |
"remove all items and submenus |
|
2091 |
" |
|
2092 |
self disabledRedrawDo:[ |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2093 |
self selection:nil. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2094 |
groupSizes := nil. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2095 |
items notNil ifTrue:[ |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2096 |
items copy do:[:el| el destroy ]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2097 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2098 |
items := nil |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2099 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2100 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2101 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2102 |
! ! |
2103 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2104 |
!MenuPanel methodsFor:'change & update'! |
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 |
update:something with:aParameter from:changedObject |
498 | 2107 |
|
2108 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2109 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2110 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2111 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2112 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2113 |
|
388 | 2114 |
!MenuPanel methodsFor:'converting'! |
2115 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2116 |
asMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2117 |
"convert contents to menu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2118 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2119 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2120 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2121 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2122 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2123 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2124 |
^ menu |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2125 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2126 |
|
388 | 2127 |
fromSpec:aMenuSpec |
2128 |
"build from spec |
|
2129 |
" |
|
2130 |
|menu| |
|
2131 |
||
2132 |
menu := Menu new. |
|
2133 |
menu fromLiteralArrayEncoding:aMenuSpec. |
|
2134 |
self menu:menu |
|
2135 |
||
2136 |
! |
|
2137 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2138 |
menu:aMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2139 |
"convert to Menu |
388 | 2140 |
" |
2141 |
self disabledRedrawDo:[ |
|
1666 | 2142 |
|menu newItems| |
2143 |
||
2144 |
self removeAll. |
|
2145 |
||
2146 |
(menu := aMenu) notNil ifTrue:[ |
|
2147 |
(aMenu isCollection) ifTrue:[ |
|
2148 |
menu := Menu new. |
|
2149 |
menu fromLiteralArrayEncoding:aMenu. |
|
2150 |
] ifFalse:[ |
|
2151 |
menu receiver notNil ifTrue:[receiver := menu receiver] |
|
2152 |
]. |
|
2153 |
(newItems := menu menuItems) size > 0 ifTrue:[ |
|
2154 |
items := newItems collect:[:ni | |
|
2155 |
|i| |
|
2156 |
||
2157 |
i:= Item in:self. |
|
2158 |
i menuItem:ni. |
|
2159 |
i. |
|
2160 |
]. |
|
2161 |
]. |
|
2162 |
self groupSizes:(menu groupSizes). |
|
2163 |
] |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2164 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2165 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2166 |
"Modified: / 8.8.1998 / 02:05:04 / cg" |
388 | 2167 |
! ! |
2168 |
||
2169 |
!MenuPanel methodsFor:'drawing'! |
|
2170 |
||
2171 |
disabledRedrawDo:aBlock |
|
2172 |
"evaluate a block without redrawing within the block; after processing |
|
2173 |
of the block a redraw might be performed |
|
2174 |
" |
|
2175 |
|state| |
|
2176 |
||
2177 |
state := mustRearrange. |
|
2178 |
mustRearrange := true. |
|
2179 |
aBlock value. |
|
2180 |
mustRearrange := state. |
|
2181 |
self mustRearrange |
|
2182 |
! |
|
2183 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2184 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2185 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2186 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2187 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2188 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2189 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2190 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2191 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2192 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2193 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2194 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2195 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2196 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2197 |
level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2198 |
shadow:buttonShadowColor |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2199 |
light:buttonLightColor |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2200 |
halfShadow:buttonHalfShadowColor |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2201 |
halfLight:buttonHalfLightColor |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2202 |
style:ButtonEdgeStyle |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2203 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2204 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2205 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2206 |
|
2016 | 2207 |
drawItemsX:x y:y width:w height:h |
2208 |
"redraw items and groups in a damage |
|
2209 |
" |
|
2210 |
|isVertical item layout prevClip |
|
2211 |
x1 "{ Class:SmallInteger }" |
|
2212 |
x2 "{ Class:SmallInteger }" |
|
2213 |
y1 "{ Class:SmallInteger }" |
|
2214 |
y2 "{ Class:SmallInteger }" |
|
2215 |
start "{ Class:SmallInteger }" |
|
2216 |
stop "{ Class:SmallInteger }" |
|
2217 |
size "{ Class:SmallInteger }" |
|
2218 |
groupDivInset "{ Class:SmallInteger }" |
|
2219 |
| |
|
2220 |
||
2221 |
size := items size. |
|
2222 |
isVertical := self verticalLayout. |
|
2223 |
||
2224 |
isVertical ifTrue:[ |
|
2225 |
start := items findFirst:[:el| el layout bottom > y ]. |
|
2226 |
start == 0 ifTrue:[ ^ self ]. |
|
2227 |
y1 := y + h. |
|
2228 |
stop := items findFirst:[:el| el layout top > y1 ] startingAt:(start + 1). |
|
2229 |
] ifFalse:[ |
|
2230 |
start := items findFirst:[:el| el layout right > x ]. |
|
2231 |
start == 0 ifTrue:[ ^ self ]. |
|
2232 |
x1 := x + w. |
|
2233 |
stop := items findFirst:[:el| el layout left > x1] startingAt:(start + 1). |
|
2234 |
]. |
|
2235 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2236 |
||
2237 |
(groupSizes size ~~ 0 and:[self showGroupDivider]) ifTrue:[ |
|
2238 |
groupDivInset := groupDividerSize // 2. |
|
2239 |
||
2240 |
groupDivInset ~~ 0 ifTrue:[ |
|
2241 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2242 |
start := start - 1 |
|
2243 |
] |
|
2244 |
]. |
|
2245 |
] ifFalse:[ |
|
2246 |
groupDivInset := 0 |
|
2247 |
]. |
|
2248 |
||
2249 |
prevClip := clipRect. |
|
2250 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2251 |
||
2252 |
start to:stop do:[:i| |
|
2253 |
item := items at:i. |
|
2254 |
item redraw. |
|
2255 |
||
2256 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2257 |
layout := item layout. |
|
2258 |
||
2259 |
isVertical ifTrue:[ |
|
2260 |
x1 := layout left. |
|
2261 |
x2 := layout right. |
|
2262 |
y1 := layout bottom + groupDivInset. |
|
2263 |
y2 := y1. |
|
2264 |
] ifFalse:[ |
|
2265 |
y1 := layout top. |
|
2266 |
y2 := layout bottom. |
|
2267 |
x1 := layout right + groupDivInset. |
|
2268 |
x2 := x1. |
|
2269 |
]. |
|
2270 |
self paint:shadowColor. |
|
2271 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2272 |
self paint:lightColor. |
|
2273 |
||
2274 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2275 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2276 |
||
2277 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2278 |
] |
|
2279 |
]. |
|
2280 |
self clippingRectangle:prevClip. |
|
2281 |
! |
|
2282 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2283 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2284 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2285 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2286 |
isSelected ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2287 |
level := onLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2288 |
] ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2289 |
anItem == enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2290 |
level := DefaultEnteredLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2291 |
] ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2292 |
level := offLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2293 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2294 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2295 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2296 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2297 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2298 |
|
1691 | 2299 |
self drawEdgesForX:(layout left) |
2300 |
y:(layout top) |
|
2301 |
width:(layout width) |
|
2302 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2303 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2304 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2305 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2306 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2307 |
|
2016 | 2308 |
drawScrollerAt:aDirection bounds:bounds |
2309 |
"draw a scroller |
|
2310 |
" |
|
2311 |
|scrolling icon level x y w h| |
|
2312 |
||
2313 |
x := bounds left. |
|
2314 |
y := bounds top. |
|
2315 |
w := bounds width. |
|
2316 |
h := bounds height. |
|
2317 |
||
2318 |
scrolling := self scrolling. |
|
2319 |
||
2320 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2321 |
level := -2 |
|
2322 |
] ifFalse:[ |
|
2323 |
level := 1 |
|
2324 |
]. |
|
2325 |
||
2326 |
level ~~ 0 ifTrue:[ |
|
2327 |
self drawEdgesForX:x y:y width:w height:h level:level. |
|
2328 |
]. |
|
2329 |
icon := scrolling iconAt:aDirection on:self. |
|
2330 |
||
2331 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2332 |
y:(y + (h - icon height // 2)). |
|
2333 |
! |
|
2334 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2335 |
invalidateItem:anItem repairNow:aBool |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2336 |
"an item changed; invalidate the items layout |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2337 |
" |
2016 | 2338 |
|layout| |
2339 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2340 |
(mustRearrange not and:[shown]) ifTrue:[ |
2016 | 2341 |
layout := anItem layout. |
2342 |
||
2343 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2344 |
self invalidate:(layout copy insetBy:-1) repairNow:aBool |
|
2345 |
] |
|
1728 | 2346 |
]. |
2347 |
||
2348 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2349 |
! |
2350 |
||
2016 | 2351 |
invalidateX:x y:y width:w height:h |
2352 |
"add a damage to redraw part of the view |
|
2353 |
" |
|
2354 |
shown ifTrue:[ |
|
2355 |
self invalidate:(Rectangle left:x top:y width:w height:h) |
|
2356 |
repairNow:false |
|
2357 |
]. |
|
2358 |
! |
|
2359 |
||
388 | 2360 |
mustRearrange |
910
5c9592e782fd
always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents:
898
diff
changeset
|
2361 |
"force rearrange (i.e. set the rearrange flag) |
388 | 2362 |
" |
590 | 2363 |
mustRearrange == true ifFalse:[ |
1117 | 2364 |
mustRearrange := true. |
2365 |
shown ifTrue:[ |
|
2366 |
self invalidate "/ RepairNow:true |
|
2367 |
] |
|
388 | 2368 |
] |
590 | 2369 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2370 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2371 |
! |
2372 |
||
710 | 2373 |
rearrangeGroups |
1699 | 2374 |
"implements the groupIdentifier #right in a horizontal menu |
2375 |
" |
|
2376 |
|layout point |
|
710 | 2377 |
dltX "{ Class:SmallInteger }" |
2378 |
start "{ Class:SmallInteger }" |
|
2379 |
| |
|
2380 |
||
2381 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
1699 | 2382 |
^ self |
710 | 2383 |
]. |
2384 |
||
2385 |
layout := items last layout. |
|
2386 |
||
1699 | 2387 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2388 |
^ self "/ no free space |
|
710 | 2389 |
]. |
2390 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2391 |
||
2392 |
start == 0 ifTrue:[ |
|
1699 | 2393 |
^ self "/ no item detected |
2394 |
]. |
|
2395 |
point := dltX @ 0. |
|
2396 |
||
2397 |
"/ move items layout to right |
|
710 | 2398 |
|
2399 |
items from:start do:[:anItem| |
|
1699 | 2400 |
anItem isVisible ifTrue:[ |
2401 |
anItem layout moveBy:point. |
|
2402 |
] |
|
710 | 2403 |
]. |
2404 |
! |
|
2405 |
||
388 | 2406 |
rearrangeItems |
1699 | 2407 |
"recompute the layout of each item |
2016 | 2408 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!! |
1699 | 2409 |
" |
1791 | 2410 |
|isVertical extent isPopUpMenu |
1699 | 2411 |
x "{ Class:SmallInteger }" |
2412 |
y "{ Class:SmallInteger }" |
|
2413 |
x0 "{ Class:SmallInteger }" |
|
2414 |
y0 "{ Class:SmallInteger }" |
|
2415 |
x1 "{ Class:SmallInteger }" |
|
2416 |
y1 "{ Class:SmallInteger }" |
|
2417 |
size "{ Class:SmallInteger }" |
|
2418 |
inset "{ Class:SmallInteger }" |
|
2419 |
labelInset "{ Class:SmallInteger }" |
|
2420 |
buttonInset "{ Class:SmallInteger }" |
|
710 | 2421 |
| |
1699 | 2422 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2423 |
mustRearrange := false. |
390 | 2424 |
^ self |
2425 |
]. |
|
2016 | 2426 |
mustRearrange := false. |
1699 | 2427 |
isVertical := self verticalLayout. |
2428 |
buttonInset := DefaultButtonItemSpace abs. |
|
1791 | 2429 |
isPopUpMenu := self isPopUpView. |
2430 |
||
2431 |
isPopUpMenu ifFalse:[ |
|
1699 | 2432 |
labelInset := DefaultEnteredLevel abs. |
2433 |
] ifTrue:[ |
|
2434 |
labelInset := 0 |
|
388 | 2435 |
]. |
390 | 2436 |
|
2016 | 2437 |
(isPopUpMenu or:[explicitExtent ~~ true]) ifTrue:[ |savExt maxExt| |
2438 |
savExt := extent := self preferredExtent copy. |
|
1478 | 2439 |
|
1791 | 2440 |
isPopUpMenu ifFalse:[ |
1699 | 2441 |
isVertical ifTrue:[extent y:1.0] ifFalse:[extent x:1.0] |
2016 | 2442 |
] ifTrue:[ |
2443 |
savExt := extent copy. |
|
2444 |
maxExt := self maxExtent. |
|
2445 |
||
2446 |
isVertical ifTrue:[ |
|
2447 |
extent y:(extent y min:(maxExt y)) |
|
2448 |
] ifFalse:[ |
|
2449 |
extent x:(extent x min:(maxExt x)) |
|
2450 |
] |
|
1478 | 2451 |
]. |
2016 | 2452 |
self extent:extent. |
2453 |
extent := savExt. |
|
390 | 2454 |
] ifFalse:[ |
1699 | 2455 |
extent := self computeExtent |
390 | 2456 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2457 |
|
1093 | 2458 |
x := y := margin. |
2459 |
||
1699 | 2460 |
isVertical ifFalse:[ |
2461 |
y0 := margin. |
|
2462 |
y1 := extent y - margin. |
|
2463 |
||
2464 |
items keysAndValuesDo:[:anIndex :el| |
|
2465 |
el isVisible ifFalse:[ |
|
2466 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2467 |
] ifTrue:[ |
|
1478 | 2468 |
el isButton ifTrue:[ |
1699 | 2469 |
inset := DefaultButtonItemSpace |
2062 | 2470 |
] ifFalse:[ |
1699 | 2471 |
inset := labelInset |
1478 | 2472 |
]. |
1699 | 2473 |
x0 := x + inset. |
2474 |
x1 := x0 + el preferredExtent x. |
|
2475 |
el layout:(Rectangle left:x0 top:(y0 + inset) right:x1 bottom:(y1 - inset)). |
|
2476 |
x := x1 + inset. |
|
2477 |
||
2478 |
size ~~ anIndex ifTrue:[ |
|
2479 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2480 |
x := x + groupDividerSize |
|
2481 |
] ifFalse:[ |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2482 |
el isLabeledItem ifTrue:[ |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2483 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2484 |
] |
1699 | 2485 |
] |
2486 |
] |
|
1478 | 2487 |
]. |
1699 | 2488 |
]. |
2489 |
] ifTrue:[ |
|
2490 |
x0 := margin. |
|
2491 |
x1 := extent x - margin. "/ -1 |
|
2492 |
||
2493 |
items keysAndValuesDo:[:anIndex :el| |
|
2494 |
el isVisible ifFalse:[ |
|
2495 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2496 |
] ifTrue:[ |
|
2497 |
el isButton ifTrue:[ |
|
2498 |
inset := DefaultButtonItemSpace |
|
2499 |
] ifFalse:[ |
|
2500 |
inset := labelInset |
|
2501 |
]. |
|
2502 |
y0 := y + inset. |
|
2503 |
y1 := y0 + el preferredExtent y. |
|
2504 |
el layout:(Rectangle left:(x0 + inset) top:y0 right:(x1 - inset) bottom:y1). |
|
2505 |
y := y1 + inset. |
|
2506 |
||
2507 |
size ~~ anIndex ifTrue:[ |
|
2508 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2509 |
y := y + groupDividerSize |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2510 |
"/ ] ifFalse:[ |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2511 |
"/ y := y + itemSpace |
1699 | 2512 |
] |
2513 |
] |
|
1478 | 2514 |
] |
2515 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2516 |
]. |
710 | 2517 |
self rearrangeGroups. |
2048 | 2518 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2519 |
mustRearrange := false. |
2048 | 2520 |
|
2521 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2522 |
! |
2523 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2524 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2525 |
"check for items which can change its visibility; |
2526 |
if at least one item exists, rearrange all items |
|
2527 |
" |
|
1464 | 2528 |
items isNil ifTrue:[^ self]. |
1699 | 2529 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2530 |
items do:[:item | |
1464 | 2531 |
item canChangeVisibility ifTrue:[ |
2532 |
mustRearrange := true. |
|
2533 |
self rearrangeItems. |
|
2534 |
^ self |
|
2535 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2536 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2537 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2538 |
|
388 | 2539 |
redrawX:x y:y width:w height:h |
2016 | 2540 |
"redraw a damage |
2541 |
" |
|
2052 | 2542 |
|y0 y1 x0 x1 bounds mustDrawPrevScroller mustDrawNextScroller| |
388 | 2543 |
|
710 | 2544 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2545 |
|
1699 | 2546 |
mustRearrange ifTrue:[ |
2547 |
self isPopUpView not ifTrue:[explicitExtent := true]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2548 |
self rearrangeItems. |
1699 | 2549 |
^ self invalidate |
2550 |
]. |
|
2551 |
self paint:(self backgroundColor). |
|
2552 |
self clearRectangleX:x y:y width:w height:h. |
|
2553 |
||
2016 | 2554 |
items size == 0 ifTrue:[ |
1699 | 2555 |
^ self |
2556 |
]. |
|
2016 | 2557 |
y0 := y. |
2558 |
y1 := y + h. |
|
2018 | 2559 |
x0 := x. |
2560 |
x1 := x + w. |
|
2016 | 2561 |
|
2562 |
self hasScrollers ifTrue:[ |
|
2563 |
(self hasScrollerAt:#PREV) ifTrue:[ |
|
2564 |
bounds := self scrollerBoundsAt:#PREV. |
|
2052 | 2565 |
mustDrawPrevScroller := false. |
2016 | 2566 |
|
2018 | 2567 |
self verticalLayout ifTrue:[ |
2568 |
bounds bottom > y ifTrue:[ |
|
2569 |
y0 := bounds bottom. |
|
2052 | 2570 |
mustDrawPrevScroller := true. |
2018 | 2571 |
]. |
2572 |
] ifFalse:[ |
|
2573 |
bounds right > x ifTrue:[ |
|
2574 |
x0 := bounds right. |
|
2052 | 2575 |
mustDrawPrevScroller := true. |
2018 | 2576 |
]. |
2052 | 2577 |
]. |
2578 |
mustDrawPrevScroller ifTrue:[ |
|
2579 |
self drawScrollerAt:#PREV bounds:bounds. |
|
2580 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2581 |
]. |
2016 | 2582 |
|
2583 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
|
2584 |
bounds := self scrollerBoundsAt:#NEXT. |
|
2052 | 2585 |
mustDrawNextScroller := false. |
2016 | 2586 |
|
2018 | 2587 |
self verticalLayout ifTrue:[ |
2588 |
bounds top < y1 ifTrue:[ |
|
2589 |
y1 := bounds top. |
|
2052 | 2590 |
mustDrawNextScroller := true. |
2018 | 2591 |
] |
2592 |
] ifFalse:[ |
|
2593 |
bounds left < x1 ifTrue:[ |
|
2594 |
x1 := bounds left. |
|
2052 | 2595 |
mustDrawNextScroller := true. |
2018 | 2596 |
] |
2052 | 2597 |
]. |
2598 |
mustDrawNextScroller ifTrue:[ |
|
2599 |
self drawScrollerAt:#NEXT bounds:bounds. |
|
2600 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2601 |
] |
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2602 |
]. |
2018 | 2603 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
2604 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
|
2016 | 2605 |
]. |
2052 | 2606 |
|
2607 |
"Modified: / 15.11.2001 / 20:57:32 / cg" |
|
388 | 2608 |
! ! |
2609 |
||
2610 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2611 |
||
2612 |
collect:aOneArgBlock |
|
2613 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2614 |
and return a collection of the results |
|
2615 |
" |
|
2616 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
|
2059 | 2617 |
^ nil |
388 | 2618 |
! |
2619 |
||
2620 |
do:aOneArgBlock |
|
2621 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel. |
|
2622 |
" |
|
2623 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
|
2624 |
||
2625 |
! |
|
2626 |
||
2627 |
findFirst:aOneArgBlock |
|
2628 |
"find the first item, for which evaluation of the argument, aOneArgBlock |
|
2629 |
returns true; return its index or 0 if none detected. |
|
2630 |
" |
|
2631 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
|
2632 |
^ 0 |
|
2633 |
||
2634 |
! |
|
2635 |
||
2636 |
findLast:aOneArgBlock |
|
2637 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2638 |
returns true; return its index or 0 if none detected. |
|
2639 |
" |
|
2640 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
|
2641 |
^ 0 |
|
2642 |
||
2643 |
! |
|
2644 |
||
390 | 2645 |
indexOf:something |
2646 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2647 |
If no item match 0 is returned. No range checks are performed on a number argument |
|
388 | 2648 |
" |
390 | 2649 |
|i v| |
2650 |
||
2651 |
something isNumber ifTrue:[ ^ something ]. |
|
2652 |
something isNil ifTrue:[ ^ 0 ]. |
|
2653 |
||
1218 | 2654 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2655 |
|
2656 |
i ~~ 0 ifTrue:[ |
|
1368 | 2657 |
^ i |
388 | 2658 |
]. |
390 | 2659 |
|
2660 |
something isSymbol ifTrue:[ |
|
1368 | 2661 |
i := self findFirst:[:el| |
2662 |
v := el value. |
|
2663 |
v isSymbol and:[v == something] |
|
2664 |
]. |
|
2665 |
i ~~ 0 ifTrue:[ |
|
2666 |
^ i |
|
2667 |
] |
|
390 | 2668 |
]. |
2669 |
||
2670 |
(something respondsTo:#string) ifTrue:[ |
|
1368 | 2671 |
v := something string. |
1218 | 2672 |
^ self findFirst:[:el | el textLabel = v]. |
2673 |
]. |
|
2674 |
^ 0 |
|
388 | 2675 |
! |
2676 |
||
706 | 2677 |
indexOfItem:anItem |
2678 |
"returns the index of the item or 0 |
|
2679 |
" |
|
2680 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
|
2681 |
! |
|
2682 |
||
388 | 2683 |
keysAndValuesDo:aTwoArgBlock |
2684 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel. |
|
2685 |
" |
|
2686 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
|
2687 |
||
2688 |
! ! |
|
2689 |
||
2690 |
!MenuPanel methodsFor:'event handling'! |
|
2691 |
||
2692 |
buttonMotion:state x:x y:y |
|
2693 |
"open or close the corresponding submenus |
|
2694 |
" |
|
2046 | 2695 |
|menue motionPoint translatedPoint sensor| |
1699 | 2696 |
|
2016 | 2697 |
self scrolling isActive ifTrue:[ |
2698 |
^ self |
|
2699 |
]. |
|
2700 |
||
1699 | 2701 |
sensor := self sensor. |
2702 |
||
2703 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
2704 |
^ self |
|
2705 |
]. |
|
2706 |
menue := self detectGrabMenu. |
|
1841 | 2707 |
|
2046 | 2708 |
motionPoint := x@y. |
2709 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 2710 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 2711 |
|
2712 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
|
2713 |
^ self |
|
2714 |
]. |
|
2715 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2716 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
1699 | 2717 |
"/ selection on grabView withou a submenu (Button ...); check whether moving out |
2046 | 2718 |
(self containsPoint:motionPoint) ifFalse:[ |
1699 | 2719 |
^ self accept:nil |
2720 |
] |
|
2721 |
]. |
|
2722 |
||
2048 | 2723 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 2724 |
! |
2725 |
||
2726 |
buttonPress:button x:x y:y |
|
2727 |
"any button pressed; open or close the corresponding submenus |
|
2728 |
" |
|
2016 | 2729 |
|menu point| |
2730 |
||
2731 |
self scrolling stop. |
|
2732 |
"/ self scrolling inspect. |
|
2733 |
point := x@y. |
|
2734 |
menu := self detectMenuAtGrabPoint:point. |
|
2735 |
||
2736 |
menu isNil ifTrue:[ |
|
2737 |
self accept:nil |
|
2738 |
] ifFalse:[ |
|
2739 |
point := menu translateGrabPoint:point. |
|
2046 | 2740 |
menu handleButtonPressAtPoint:point. |
2016 | 2741 |
] |
2046 | 2742 |
|
2743 |
"Modified: / 13.11.2001 / 14:12:32 / cg" |
|
1699 | 2744 |
! |
2745 |
||
2746 |
buttonRelease:button x:x y:y |
|
2747 |
"button release action; accept selection and close all views |
|
2748 |
" |
|
2749 |
|topMenu dstMenu item srcPoint dstPoint| |
|
2750 |
||
2016 | 2751 |
self scrolling stop ifTrue:[ |
2752 |
^ self |
|
2753 |
]. |
|
2754 |
||
1699 | 2755 |
topMenu := self topMenu. |
2756 |
dstMenu := topMenu activeMenu. |
|
2757 |
||
2758 |
( dstMenu selection notNil |
|
2759 |
or:[dstMenu isPopUpView not |
|
2760 |
or:[(OperatingSystem millisecondTimeDeltaBetween:(Time millisecondClockValue) |
|
2761 |
and:(dstMenu mapTime)) > 400]] |
|
388 | 2762 |
) ifTrue:[ |
1699 | 2763 |
srcPoint := x@y. |
2764 |
||
2765 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
|
2766 |
and:[(item := dstMenu selection) notNil] |
|
2767 |
) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2768 |
item visibleSubmenu notNil ifTrue:[ |
1699 | 2769 |
dstMenu selection:nil. |
2770 |
||
2771 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
|
2772 |
self accept:nil |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2773 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2774 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2775 |
item currentSubmenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2776 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2777 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2778 |
(dstMenu itemAtX:(dstPoint x) y:(dstPoint y)) == dstMenu selection ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2779 |
item := nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2780 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2781 |
topMenu acceptItem:item inMenu:dstMenu. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2782 |
] |
1699 | 2783 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2784 |
^ self |
1699 | 2785 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2786 |
|
1699 | 2787 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2788 |
selection visibleSubmenu notNil ifTrue:[ |
1699 | 2789 |
^ self |
2790 |
] |
|
2791 |
]. |
|
2792 |
self accept:nil. |
|
2793 |
]. |
|
2794 |
! |
|
2795 |
||
2796 |
keyPress:key x:x y:y |
|
2797 |
"any key is pressed |
|
2798 |
" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2799 |
|menu rawKey| |
1699 | 2800 |
|
2016 | 2801 |
self scrolling isActive ifTrue:[ |
2802 |
key ~~ #Escape ifTrue:[ |
|
2803 |
^ self |
|
2804 |
]. |
|
2805 |
self scrolling stop |
|
2806 |
]. |
|
2807 |
||
1699 | 2808 |
(key == #Tab |
2809 |
or:[key == #FocusNext |
|
2810 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
2811 |
self accept:nil. |
|
2812 |
^ super keyPress:key x:x y:y |
|
2813 |
]. |
|
2814 |
||
2815 |
menu := self detectGrabMenu. |
|
2816 |
||
2817 |
key == #Escape ifTrue:[ |
|
2818 |
"/ must hide the active menu |
|
1703 | 2819 |
((menu := menu superMenu) notNil and:[menu ~~ self]) ifTrue:[ |
2820 |
"/ hide active menu but keep the grab |
|
2821 |
menu selection:nil |
|
1699 | 2822 |
] ifFalse:[ |
1703 | 2823 |
"/ hide active menu and ungrab |
1699 | 2824 |
self accept:nil |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2825 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2826 |
] ifFalse:[ |
1793 | 2827 |
menu isViewWrapper ifFalse:[ |
2828 |
self sensor compressKeyPressEventsWithKey:key. |
|
2829 |
||
2830 |
menu handleKeyPress:key. |
|
2831 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2832 |
"/ selection isNil ifTrue:[ |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2833 |
"/ self accept:nil keepValue:true |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2834 |
"/ ] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2835 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2836 |
]. |
1699 | 2837 |
! |
2838 |
||
2839 |
pointerLeave:state |
|
2840 |
||
2016 | 2841 |
self scrolling isActive ifTrue:[^ self]. |
2842 |
||
1699 | 2843 |
self detectGrabMenu handlePointerLeave:state. |
2844 |
||
2845 |
self isPopUpView ifTrue:[ |
|
2846 |
^ self |
|
2847 |
]. |
|
2016 | 2848 |
(selection notNil and:[selection hasSubmenu not]) ifTrue:[ |
1699 | 2849 |
"/ selection on grabView withou a submenu (Button ...); check whether moving out |
2850 |
self sensor anyButtonPressed ifFalse:[ |
|
2851 |
^ self accept:nil |
|
2852 |
] |
|
2853 |
]. |
|
2854 |
! |
|
2855 |
||
2856 |
sizeChanged:how |
|
2857 |
"redraw #right groups |
|
2858 |
" |
|
2018 | 2859 |
self isPopUpView ifFalse:[ |
2860 |
mustRearrange := true. |
|
2861 |
shown ifTrue:[ |
|
2862 |
self invalidate |
|
1699 | 2863 |
] |
2864 |
]. |
|
2865 |
super sizeChanged:how |
|
2866 |
! ! |
|
2867 |
||
2868 |
!MenuPanel methodsFor:'event handling processing'! |
|
2869 |
||
1767 | 2870 |
clearImplicitGrab |
2871 |
self menuAdornmentAt:#implicitGrabView put:nil. |
|
2872 |
self menuAdornmentAt:#lastPointerView put:nil. |
|
2873 |
||
2874 |
||
2875 |
! |
|
2876 |
||
2877 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2878 |
"dispatch and handle an event |
|
2879 |
" |
|
2880 |
|view x y p syntheticEvent implicitGrabView lastPointerView menu| |
|
2881 |
||
2882 |
implicitGrabView := self menuAdornmentAt:#implicitGrabView. |
|
2883 |
||
2884 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
|
2885 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
2886 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
2887 |
implicitGrabView notNil ifTrue:[ |
|
2888 |
self sensor leftButtonPressed ifFalse:[ |
|
2889 |
self clearImplicitGrab. |
|
2890 |
]. |
|
2891 |
]. |
|
2892 |
||
2893 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2894 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2895 |
]. |
|
2896 |
||
2897 |
implicitGrabView notNil ifTrue:[ |
|
2898 |
ev isButtonEvent ifTrue:[ |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
2899 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
1767 | 2900 |
ev view:implicitGrabView. |
2901 |
ev arguments at:2 put:p x. |
|
2902 |
ev arguments at:3 put:p y. |
|
2903 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2904 |
||
2905 |
ev isButtonReleaseEvent ifTrue:[ |
|
2906 |
self clearImplicitGrab. |
|
2907 |
]. |
|
2908 |
^ self |
|
2909 |
] |
|
2910 |
]. |
|
2911 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
2912 |
||
2016 | 2913 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
1767 | 2914 |
self clearImplicitGrab. |
2915 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
|
2916 |
]. |
|
2917 |
||
2918 |
p := menu translateGrabPoint:(x@y). |
|
2919 |
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
|
2920 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 2921 |
|
2922 |
ev isButtonPressEvent ifTrue:[ |
|
2923 |
(view wantsFocusWithButtonPress) ifTrue:[ |
|
2924 |
view requestFocus. |
|
2925 |
]. |
|
2926 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
2927 |
self menuAdornmentAt:#implicitGrabView put:view. |
|
2928 |
] |
|
2929 |
]. |
|
2930 |
lastPointerView := self menuAdornmentAt:#lastPointerView. |
|
2931 |
||
2932 |
ev isButtonMotionEvent ifTrue:[ |
|
2933 |
lastPointerView ~~ view ifTrue:[ |
|
2934 |
"/ must generate enter/leave ... (sigh) |
|
2935 |
lastPointerView notNil ifTrue:[ |
|
2936 |
syntheticEvent := WindowEvent inputEvent |
|
2937 |
for:lastPointerView |
|
2938 |
type:#pointerLeave: |
|
2939 |
arguments:(Array with:0). "/ XXX: should be fixed |
|
2940 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
2941 |
]. |
|
2942 |
view notNil ifTrue:[ |
|
2943 |
syntheticEvent := WindowEvent inputEvent |
|
2944 |
for:view |
|
2945 |
type:#pointerEnter:x:y: |
|
2946 |
arguments:(Array with:0 with:x with:y). |
|
2947 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
2948 |
]. |
|
2949 |
self menuAdornmentAt:#lastPointerView put:view. |
|
2950 |
]. |
|
2951 |
]. |
|
2952 |
||
2953 |
ev view:view. |
|
2954 |
ev x:p x. |
|
2955 |
ev y:p y. |
|
2956 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
2957 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
2958 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 2959 |
! |
2960 |
||
2048 | 2961 |
handleButtonMotion:state atPoint:motionPoint |
1699 | 2962 |
"open or close the corresponding submenus |
2963 |
" |
|
2048 | 2964 |
|menu translatedPoint sel| |
1699 | 2965 |
|
1910 | 2966 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2967 |
"/ highlight enterItem if no selection exists |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2968 |
selection isNil ifTrue:[ |
2046 | 2969 |
(self containsPoint:motionPoint) ifTrue:[ |
2970 |
((sel := self itemAtPoint:motionPoint) isNil or:[sel canSelect not]) ifTrue:[ |
|
1699 | 2971 |
^ self pointerEntersItem:nil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2972 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2973 |
(DefaultSelectionFollowsMouse and:[superMenu notNil]) ifTrue:[ |
2061 | 2974 |
self select:sel openMenu:true. |
2975 |
"/ self openMenuOnSelect:true. |
|
2976 |
"/ self selection:sel. |
|
2977 |
"/ self openMenuOnSelect:nil. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2978 |
] ifFalse:[ |
1699 | 2979 |
self pointerEntersItem:sel |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2980 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2981 |
^ self |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2982 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2983 |
]. |
1699 | 2984 |
self pointerEntersItem:nil. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2985 |
|
2048 | 2986 |
(DefaultSelectionFollowsMouse and:[(menu := self superMenuAtPoint:motionPoint) notNil]) ifTrue:[ |
2046 | 2987 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2988 |
sel := menu itemAtPoint:translatedPoint. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2989 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2990 |
(sel notNil and:[sel canSelect]) ifTrue:[ |
2061 | 2991 |
self select:sel openMenu:true. |
2992 |
"/ self openMenuOnSelect:true. |
|
2993 |
"/ self selection:sel. |
|
2994 |
"/ self openMenuOnSelect:nil. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2995 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2996 |
]. |
2048 | 2997 |
^ self |
2998 |
]. |
|
2999 |
||
1699 | 3000 |
self pointerEntersItem:nil. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3001 |
|
2048 | 3002 |
(menu := self superMenuAtPoint:motionPoint) isNil ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3003 |
self isPopUpView ifTrue:[ |
1699 | 3004 |
self selection:nil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3005 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3006 |
^ self |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3007 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3008 |
|
1699 | 3009 |
menu == self ifTrue:[ |
2046 | 3010 |
(sel := self itemAtPoint:motionPoint) notNil ifTrue:[ |
2061 | 3011 |
self select:sel openMenu:true. |
3012 |
"/ self openMenuOnSelect:true. |
|
3013 |
"/ self selection:sel. |
|
3014 |
"/ self openMenuOnSelect:nil. |
|
1699 | 3015 |
]. |
388 | 3016 |
] ifFalse:[ |
2046 | 3017 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
3018 |
sel := menu itemAtPoint:translatedPoint. |
|
1699 | 3019 |
|
3020 |
(sel isNil and:[menu isPopUpView not]) ifTrue:[ |
|
3021 |
sel := menu selection. |
|
3022 |
]. |
|
2061 | 3023 |
menu select:sel openMenu:true. |
3024 |
"/ menu openMenuOnSelect:true. |
|
3025 |
"/ menu selection:sel. |
|
3026 |
"/ menu openMenuOnSelect:nil. |
|
1699 | 3027 |
] |
3028 |
||
2048 | 3029 |
"Created: / 13.11.2001 / 20:21:24 / cg" |
3030 |
"Modified: / 13.11.2001 / 20:26:32 / cg" |
|
2046 | 3031 |
! |
3032 |
||
3033 |
handleButtonPressAtPoint:aPoint |
|
2016 | 3034 |
"a button pressed; open or close the corresponding submenus |
3035 |
" |
|
3036 |
|item sensor yS direction| |
|
3037 |
||
2046 | 3038 |
item := self itemAtPoint:aPoint. |
2016 | 3039 |
|
3040 |
item notNil ifTrue:[ |
|
2046 | 3041 |
direction := self scrollerDirectionAtPoint:aPoint. |
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3042 |
direction notNil ifTrue:[ |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3043 |
(self scrolling startIfRequiredAt:direction on:self) ifTrue:[ |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3044 |
self pointerEntersItem:nil. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3045 |
^ self |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3046 |
] |
2016 | 3047 |
] |
3048 |
]. |
|
3049 |
||
3050 |
self openMenuOnSelect:true. |
|
3051 |
self selection:item. |
|
3052 |
self openMenuOnSelect:nil. |
|
3053 |
||
3054 |
( item notNil |
|
3055 |
and:[item triggerOnDown |
|
3056 |
and:[item canAccept |
|
3057 |
and:[item == self selection]]] |
|
3058 |
) ifTrue:[ |
|
3059 |
self invalidateItem:item repairNow:true. |
|
3060 |
self acceptItem:item inMenu:self. |
|
3061 |
||
3062 |
self selection == item ifTrue:[ |
|
3063 |
(sensor := self sensor) notNil ifTrue:[ |
|
3064 |
[sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ]. |
|
3065 |
sensor flushUserEvents. |
|
3066 |
]. |
|
3067 |
self selection:nil. |
|
3068 |
] |
|
3069 |
]. |
|
2046 | 3070 |
|
3071 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3072 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3073 |
! |
3074 |
||
1699 | 3075 |
handleCursorKey:aKey |
388 | 3076 |
"handle a cursor key |
3077 |
" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3078 |
|next menu item isVrt backKey p1 p2 |
687 | 3079 |
idx "{ Class:SmallInteger }" |
1705 | 3080 |
size "{ Class:SmallInteger }" |
687 | 3081 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3082 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3083 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
388 | 3084 |
^ self |
3085 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3086 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3087 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3088 |
|
2016 | 3089 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3090 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3091 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3092 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3093 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3094 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3095 |
^ superMenu handleCursorKey:aKey |
1699 | 3096 |
]. |
2016 | 3097 |
idx := 0. |
3098 |
||
3099 |
isVrt ifTrue:[ |
|
3100 |
"/ used because of vertical scrolling |
|
3101 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
3102 |
idx ~~ 0 ifTrue:[idx := idx := idx - 1 ] |
|
3103 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3104 |
] ifFalse:[ |
2016 | 3105 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3106 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3107 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3108 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3109 |
size timesRepeat:[|el| |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3110 |
next ifTrue:[(idx := idx + 1) > size ifTrue:[idx := 1]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3111 |
ifFalse:[(idx := idx - 1) < 1 ifTrue:[idx := size]]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3112 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3113 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
2016 | 3114 |
el canSelect ifTrue:[^ self selection:el]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3115 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3116 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3117 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3118 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3119 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3120 |
superMenu notNil ifTrue:[ |
1791 | 3121 |
p1 := self translateGrabPoint:0. |
3122 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3123 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3124 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3125 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3126 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3127 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3128 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3129 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3130 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3131 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3132 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3133 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3134 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3135 |
backKey := #CursorUp. |
1699 | 3136 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3137 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3138 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3139 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3140 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3141 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3142 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3143 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3144 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3145 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3146 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3147 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3148 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3149 |
^ self |
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 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3152 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3153 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3154 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3155 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3156 |
superMenu handleCursorKey:aKey |
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 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3159 |
self selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3160 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3161 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3162 |
^ self |
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 |
selection hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3166 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3167 |
selection toggleSubmenuVisibility |
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 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3170 |
] |
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 notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3173 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3174 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3175 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3176 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3177 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3178 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3179 |
]. |
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 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3182 |
handleKeyPress:key |
1699 | 3183 |
"any key is pressed |
3184 |
" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3185 |
|item inMenu rawKey| |
1699 | 3186 |
|
3187 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3188 |
self handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3189 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3190 |
key isCharacter ifTrue:[ |
1862 | 3191 |
"/ selection notNil ifTrue:[ |
3192 |
"/ inMenu := self |
|
3193 |
"/ ] ifFalse:[ |
|
3194 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3195 |
"/ ]. |
|
3196 |
inMenu := self. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3197 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3198 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3199 |
inMenu selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3200 |
] |
1699 | 3201 |
] ifFalse:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3202 |
( key == #CursorDown or:[key == #CursorUp |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3203 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3204 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3205 |
self handleCursorKey:key |
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 |
] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3208 |
] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3209 |
! |
1699 | 3210 |
|
3211 |
handlePointerLeave:state |
|
3212 |
self pointerEntersItem:nil. |
|
3213 |
super pointerLeave:state |
|
3214 |
! |
|
3215 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3216 |
handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3217 |
"any key is pressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3218 |
" |
1841 | 3219 |
|sensor| |
3220 |
||
3221 |
selection isNil ifTrue:[ |
|
3222 |
superMenu notNil ifTrue:[ |
|
3223 |
superMenu selection toggleSubmenuVisibility |
|
3224 |
] ifFalse:[ |
|
3225 |
self accept |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3226 |
]. |
1841 | 3227 |
^ self |
3228 |
]. |
|
3229 |
selection hasSubmenu ifTrue:[ |
|
3230 |
^ selection toggleSubmenuVisibility |
|
3231 |
]. |
|
3232 |
self accept. |
|
3233 |
||
3234 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3235 |
^ self |
|
3236 |
]. |
|
3237 |
||
3238 |
(sensor := self sensor) isNil ifTrue:[ |
|
3239 |
^ self |
|
3240 |
]. |
|
3241 |
||
3242 |
[ sensor flushKeyboardFor:nil. |
|
3243 |
Delay waitForSeconds:0.1. |
|
3244 |
sensor hasKeyPressEventFor:nil. |
|
3245 |
||
3246 |
] whileTrue. |
|
3247 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3248 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3249 |
|
1699 | 3250 |
pointerEntersItem:anItemOrNil |
3251 |
"the pointer moves over an item or nil; restore the old item and |
|
3252 |
redraw the new item highlighted. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3253 |
" |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3254 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3255 |
|
1699 | 3256 |
( anItemOrNil notNil |
3257 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3258 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3259 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3260 |
anItemOrNil isButton ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3261 |
( buttonEnteredBgColor ~= ButtonPassiveBackgroundColor |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3262 |
or:[ButtonEnteredLevel ~~ ButtonPassiveLevel] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3263 |
) ifTrue:[ |
1699 | 3264 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3265 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3266 |
] ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3267 |
DefaultEnteredLevel ~~ 0 ifTrue:[ |
1699 | 3268 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3269 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3270 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3271 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3272 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3273 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3274 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3275 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3276 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3277 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3278 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3279 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3280 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3281 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3282 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3283 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3284 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3285 |
|
388 | 3286 |
! ! |
3287 |
||
3288 |
!MenuPanel methodsFor:'grabbing'! |
|
3289 |
||
1699 | 3290 |
doGrab |
3291 |
relativeGrabOrigin := nil. |
|
3292 |
||
3293 |
superMenu notNil ifTrue:[ |
|
3294 |
superMenu doGrab |
|
3295 |
] ifFalse:[ |
|
3296 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3297 |
self grabMouseAndKeyboard. |
|
3298 |
hasImplicitGrap := true |
|
3299 |
] |
|
3300 |
] |
|
3301 |
! |
|
3302 |
||
3303 |
doUngrab:forceDo |
|
3304 |
||
3305 |
relativeGrabOrigin := nil. |
|
1767 | 3306 |
self clearImplicitGrab. |
1699 | 3307 |
|
3308 |
superMenu notNil ifTrue:[ |
|
3309 |
forceDo ifTrue:[ |
|
3310 |
superMenu doUngrab:true |
|
3311 |
]. |
|
3312 |
^ self |
|
3313 |
]. |
|
3314 |
||
3315 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3316 |
^ self |
|
3317 |
]. |
|
3318 |
||
3319 |
forceDo ifFalse:[ |
|
1703 | 3320 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
1699 | 3321 |
^ self |
3322 |
]. |
|
3323 |
]. |
|
3324 |
self ungrabMouseAndKeyboard. |
|
3325 |
self selection:nil. |
|
3326 |
hasImplicitGrap := nil. |
|
1703 | 3327 |
prevFocusView := nil. |
3328 |
||
1699 | 3329 |
! |
3330 |
||
1630 | 3331 |
grabKeyboard |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3332 |
"grap the keyboard; keep previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3333 |
" |
1630 | 3334 |
previousKeyboardGrab := device activeKeyboardGrab. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3335 |
^ super grabKeyboard |
1630 | 3336 |
|
3337 |
||
3338 |
! |
|
3339 |
||
388 | 3340 |
grabMouseAndKeyboard |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3341 |
"get exclusive access to pointer and keyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3342 |
" |
388 | 3343 |
|sensor| |
3344 |
||
3345 |
realized ifTrue:[ |
|
1703 | 3346 |
prevFocusView := self windowGroup focusView. |
1612 | 3347 |
|
1575 | 3348 |
sensor := self sensor. |
3349 |
device activePointerGrab ~~ self ifTrue:[ |
|
3350 |
sensor notNil ifTrue:[ |
|
3351 |
sensor flushMotionEventsFor:nil. |
|
3352 |
]. |
|
3353 |
||
1630 | 3354 |
(self grabPointer) ifFalse:[ |
1575 | 3355 |
Delay waitForSeconds:0.1. |
1630 | 3356 |
(self grabPointer) ifFalse:[ |
1575 | 3357 |
"give up" |
3358 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
|
3359 |
self unmap |
|
3360 |
] |
|
3361 |
] |
|
3362 |
]. |
|
3363 |
||
3364 |
device activeKeyboardGrab ~~ self ifTrue:[ |
|
3365 |
sensor notNil ifTrue:[ |
|
3366 |
device sync. |
|
3367 |
sensor flushKeyboardFor:nil |
|
3368 |
]. |
|
1630 | 3369 |
self grabKeyboard. |
1575 | 3370 |
] |
388 | 3371 |
] |
3372 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3373 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3374 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3375 |
! |
3376 |
||
1630 | 3377 |
grabPointerWithCursor:aCursorOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3378 |
"grap the pointer; keep previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3379 |
" |
1630 | 3380 |
previousPointerGrab := device activePointerGrab. |
1699 | 3381 |
hasImplicitGrap := true. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3382 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3383 |
|
3384 |
||
3385 |
! |
|
3386 |
||
3387 |
ungrabKeyboard |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3388 |
"ungrap the keyboard; restore previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3389 |
" |
1630 | 3390 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3391 |
|
1630 | 3392 |
previousKeyboardGrab notNil ifTrue:[ |
1699 | 3393 |
device grabKeyboardInView:previousKeyboardGrab. |
1630 | 3394 |
]. |
3395 |
||
3396 |
||
3397 |
! |
|
3398 |
||
388 | 3399 |
ungrabMouseAndKeyboard |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3400 |
"ungrab resources (mouse and keyboard) |
388 | 3401 |
" |
1630 | 3402 |
self ungrabPointer. |
3403 |
self ungrabKeyboard. |
|
3404 |
! |
|
3405 |
||
3406 |
ungrabPointer |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3407 |
"ungrap the pointer; restore previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3408 |
" |
1630 | 3409 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3410 |
|
1630 | 3411 |
previousPointerGrab notNil ifTrue:[ |
1699 | 3412 |
device grabPointerInView:previousPointerGrab. |
1630 | 3413 |
]. |
3414 |
||
3415 |
||
388 | 3416 |
! ! |
3417 |
||
1251 | 3418 |
!MenuPanel methodsFor:'help'! |
3419 |
||
2058 | 3420 |
flyByHelpTextAt:srcPoint |
3421 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
|
3422 |
If there is a selection, that items helpText is used (ignoreing the given point). |
|
3423 |
" |
|
3424 |
|dstMenu dstPoint| |
|
3425 |
||
3426 |
dstMenu := self detectMenuAtGrabPoint:srcPoint. |
|
3427 |
||
3428 |
dstMenu isNil ifTrue:[ |
|
3429 |
^ '' |
|
3430 |
]. |
|
3431 |
||
3432 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
|
3433 |
^ dstMenu flyByHelpTextForItem:(dstMenu itemAtX:(dstPoint x) y:(dstPoint y)). |
|
3434 |
! |
|
3435 |
||
3436 |
flyByHelpTextForItem:anItem |
|
3437 |
"returns the helpText for an item (empty if none) |
|
3438 |
" |
|
3439 |
|key val app| |
|
3440 |
||
3441 |
anItem isNil ifTrue:[^ '']. |
|
3442 |
||
3443 |
( (key := anItem activeHelpKey) notNil |
|
3444 |
and:[(app := self application) notNil] |
|
3445 |
) ifTrue:[ |
|
3446 |
val := app flyByHelpTextForKey:key. |
|
3447 |
]. |
|
3448 |
||
3449 |
^ val |
|
3450 |
! |
|
3451 |
||
1251 | 3452 |
helpText |
1613 | 3453 |
"return the helpText for the currently selected item (empty if none) |
3454 |
" |
|
3455 |
^ self helpTextForItem:selection |
|
1251 | 3456 |
! |
3457 |
||
1699 | 3458 |
helpTextAt:srcPoint |
1252 | 3459 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
3460 |
If there is a selection, that items helpText is used (ignoreing the given point). |
|
3461 |
" |
|
1699 | 3462 |
|dstMenu dstPoint| |
3463 |
||
3464 |
dstMenu := self detectMenuAtGrabPoint:srcPoint. |
|
3465 |
||
3466 |
dstMenu isNil ifTrue:[ |
|
1613 | 3467 |
^ '' |
3468 |
]. |
|
1699 | 3469 |
|
3470 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
|
3471 |
^ dstMenu helpTextForItem:(dstMenu itemAtX:(dstPoint x) y:(dstPoint y)). |
|
1613 | 3472 |
! |
3473 |
||
3474 |
helpTextForItem:anItem |
|
3475 |
"returns the helpText for an item (empty if none) |
|
3476 |
" |
|
3477 |
|key val app| |
|
3478 |
||
3479 |
anItem isNil ifTrue:[^ '']. |
|
3480 |
||
3481 |
(val := anItem activeHelpText) isNil ifTrue:[ |
|
3482 |
( (key := anItem activeHelpKey) notNil |
|
3483 |
and:[(app := self application) notNil] |
|
3484 |
) ifTrue:[ |
|
3485 |
val := app helpTextForKey:key. |
|
3486 |
]. |
|
3487 |
anItem activeHelpText:(val ? ''). |
|
3488 |
]. |
|
3489 |
^ val |
|
1251 | 3490 |
! ! |
3491 |
||
794 | 3492 |
!MenuPanel methodsFor:'image registration'! |
3493 |
||
3494 |
imageOnDevice:anImage |
|
3495 |
"returns image registered on device |
|
3496 |
" |
|
3497 |
^ self class image:anImage onDevice:device |
|
3498 |
! |
|
3499 |
||
3500 |
lightenedImageOnDevice:anImage |
|
3501 |
"returns lightened image registered on device |
|
3502 |
" |
|
3503 |
^ self class lightenedImage:anImage onDevice:device |
|
3504 |
! ! |
|
3505 |
||
1688 | 3506 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 3507 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3508 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3509 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3510 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3511 |
|
388 | 3512 |
create |
616 | 3513 |
"create the shadow view for a none contained submenu |
388 | 3514 |
" |
3515 |
super create. |
|
3516 |
||
3517 |
self isPopUpView ifTrue:[ |
|
1499
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3518 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3519 |
shadowView isNil ifTrue:[ |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3520 |
shadowView := (ShadowView onDevice:device) for:self |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3521 |
] ifFalse:[ |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3522 |
self saveUnder:true. |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3523 |
]. |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3524 |
] |
388 | 3525 |
] ifFalse:[ |
1499
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3526 |
explicitExtent == true ifTrue:[ |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3527 |
(self width) == (superView width) ifTrue:[ |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3528 |
self verticalLayout:false |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3529 |
] |
07951b17b43e
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
3530 |
] |
388 | 3531 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3532 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3533 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 3534 |
! |
3535 |
||
3536 |
destroy |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3537 |
"destroy items and shadowView; remove dependencies |
388 | 3538 |
" |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3539 |
self clearLastActiveMenu. |
2051 | 3540 |
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
|
3541 |
items := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3542 |
|
498 | 3543 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
3544 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3545 |
|
388 | 3546 |
super destroy. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3547 |
superMenu := nil. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3548 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3549 |
|
2051 | 3550 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3551 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3552 |
|
616 | 3553 |
fetchDeviceResources |
3554 |
"fetch device colors, to avoid reallocation at redraw time" |
|
3555 |
||
3556 |
super fetchDeviceResources. |
|
3557 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
3558 |
"/ 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
|
3559 |
"/ (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
|
3560 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3561 |
onLevel := styleSheet at:#'menu.hilightLevel' default:0. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
3562 |
|
616 | 3563 |
superMenu isNil ifTrue:[ |
1705 | 3564 |
fgColor := DefaultForegroundColor onDevice:device. |
3565 |
activeBgColor := DefaultHilightBackgroundColor onDevice:device. |
|
3566 |
activeFgColor := DefaultHilightForegroundColor onDevice:device. |
|
3567 |
disabledFgColor := DefaultDisabledForegroundColor onDevice:device. |
|
2059 | 3568 |
DefaultDisabledEtchedForegroundColor notNil ifTrue: [ |
3569 |
disabledEtchedFgColor := DefaultDisabledEtchedForegroundColor onDevice:device. |
|
3570 |
]. |
|
1705 | 3571 |
rightArrow := RightArrowForm onDevice:device. |
3572 |
selectionFrameBrightColor := SelectionFrameBrightColor onDevice:device. |
|
3573 |
selectionFrameDarkColor := SelectionFrameDarkColor onDevice:device. |
|
3574 |
buttonLightColor := ButtonLightColor onDevice:device. |
|
3575 |
buttonShadowColor := ButtonShadowColor onDevice:device. |
|
3576 |
ButtonHalfLightColor notNil ifTrue: [ |
|
3577 |
buttonHalfLightColor := ButtonHalfLightColor onDevice:device]. |
|
3578 |
ButtonHalfShadowColor notNil ifTrue: [ |
|
3579 |
buttonHalfShadowColor := ButtonHalfShadowColor onDevice:device]. |
|
3580 |
buttonEnteredBgColor := ButtonEnteredBackgroundColor onDevice:device. |
|
3581 |
||
3582 |
(rightArrowShadow := RightArrowShadowForm) notNil ifTrue:[ |
|
3583 |
rightArrowShadow := rightArrowShadow onDevice:device |
|
3584 |
] |
|
616 | 3585 |
] ifFalse:[ |
1705 | 3586 |
fgColor := superMenu foregroundColor. |
3587 |
activeBgColor := superMenu activeBackgroundColor. |
|
3588 |
activeFgColor := superMenu activeForegroundColor. |
|
3589 |
disabledFgColor := superMenu disabledForegroundColor. |
|
2059 | 3590 |
disabledEtchedFgColor := superMenu disabledEtchedForegroundColor. |
1705 | 3591 |
rightArrow := superMenu rightArrow. |
3592 |
rightArrowShadow := superMenu rightArrowShadow. |
|
3593 |
selectionFrameBrightColor := superMenu selectionFrameBrightColor. |
|
3594 |
selectionFrameDarkColor := superMenu selectionFrameDarkColor. |
|
3595 |
buttonLightColor := superMenu buttonLightColor. |
|
3596 |
buttonShadowColor := superMenu buttonShadowColor. |
|
3597 |
buttonHalfLightColor := superMenu buttonHalfLightColor. |
|
3598 |
buttonHalfShadowColor := superMenu buttonHalfShadowColor. |
|
3599 |
buttonEnteredBgColor := superMenu buttonEnteredBackgroundColor. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3600 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3601 |
|
1829 | 3602 |
items notNil ifTrue:[ |
3603 |
items do:[:eachItem | |
|
3604 |
eachItem fetchDeviceResources |
|
3605 |
] |
|
3606 |
]. |
|
3607 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3608 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 3609 |
! |
3610 |
||
580 | 3611 |
initStyle |
3612 |
"initialize style specific stuff" |
|
3613 |
||
3614 |
super initStyle. |
|
616 | 3615 |
|
1336 | 3616 |
viewBackground := DefaultBackgroundColor. |
1117 | 3617 |
|
1699 | 3618 |
onLevel := DefaultHilightLevel. |
3619 |
offLevel := 0. "/ DefaultLevel. |
|
3620 |
itemSpace := DefaultItemSpace. |
|
616 | 3621 |
groupDividerSize := DefaultGroupDividerSize. |
1705 | 3622 |
fitFirstPanel := false. |
1829 | 3623 |
font := MenuView defaultFont onDevice:device. |
1923 | 3624 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3625 |
self updateLevelAndBorder. |
580 | 3626 |
! |
3627 |
||
388 | 3628 |
initialize |
3629 |
"set default configuration |
|
3630 |
" |
|
616 | 3631 |
|
388 | 3632 |
super initialize. |
616 | 3633 |
|
1730
4936edfc2eee
must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
3634 |
self enableMotionEvents. |
498 | 3635 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3636 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3637 |
self originChangedFlag:false. |
388 | 3638 |
explicitExtent := nil. |
3639 |
shortKeyInset := 0. |
|
3640 |
mustRearrange := false. |
|
3641 |
! |
|
3642 |
||
1573 | 3643 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3644 |
"grab the pointer here, when visible (but not if control has already been lost). |
388 | 3645 |
If the grab fails, try again and unmap myself if that fails too. |
3646 |
" |
|
1791 | 3647 |
|loIndices loItems| |
388 | 3648 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3649 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3650 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3651 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3652 |
self becomesActiveMenu. |
1573 | 3653 |
super map. |
388 | 3654 |
|
1785 | 3655 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 3656 |
loItems := items ? #[]. |
3657 |
||
3658 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 3659 |
|
388 | 3660 |
self isPopUpView ifTrue:[ |
1699 | 3661 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3662 |
] ifFalse:[ |
1572 | 3663 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3664 |
]. |
1791 | 3665 |
loItems do:[:el| el updateIndicators ]. |
388 | 3666 |
|
1785 | 3667 |
loIndices size > 0 ifTrue:[ |
1572 | 3668 |
self redrawX:0 y:0 width:width height:height. |
1785 | 3669 |
self openMenusFromItemIndices:loIndices. |
388 | 3670 |
]. |
3671 |
||
1177 | 3672 |
"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
|
3673 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 3674 |
! |
3675 |
||
3676 |
realize |
|
3677 |
"realize menu and shadowView |
|
3678 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3679 |
|
388 | 3680 |
self isPopUpView ifTrue:[ |
1459 | 3681 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
3682 |
shadowView must be realized before self" |
|
3683 |
self hiddenOnRealize:true. |
|
3684 |
super realize. |
|
3685 |
self resize. |
|
3686 |
self makeFullyVisible. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3687 |
"/ self mustRearrange. |
1459 | 3688 |
shadowView notNil ifTrue:[ |
3689 |
shadowView realize. |
|
3690 |
]. |
|
3691 |
self raise. |
|
1573 | 3692 |
self map. |
736 | 3693 |
] ifFalse:[ |
1459 | 3694 |
super realize. |
1767 | 3695 |
]. |
3696 |
self allSubViewsDo:[:aView| aView realize ]. |
|
388 | 3697 |
! |
3698 |
||
3699 |
recreate |
|
1832 | 3700 |
"this is called after a snapin or a migration. |
3701 |
If the image was saved with an active menu, hide the menu |
|
388 | 3702 |
" |
1455 | 3703 |
selection := nil. |
388 | 3704 |
super recreate. |
3705 |
! |
|
3706 |
||
1130 | 3707 |
reinitStyle |
3708 |
"handle style change while being open (win32 only - for now)" |
|
3709 |
||
3710 |
super reinitStyle. |
|
3711 |
||
3712 |
self fetchDeviceResources. |
|
1811 | 3713 |
self mustRearrange. "/ care for changed font sizes etc. |
3714 |
||
3715 |
self do:[:anItem | |
|
3716 |
anItem reinitStyle |
|
3717 |
]. |
|
1130 | 3718 |
|
3719 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 3720 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 3721 |
! |
3722 |
||
1796
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3723 |
reinitialize |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3724 |
"reinit after a snapIn |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3725 |
" |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3726 |
|
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3727 |
super reinitialize. |
1811 | 3728 |
"/ self reinitStyle. |
3729 |
||
3730 |
"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
|
3731 |
! |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3732 |
|
388 | 3733 |
unmap |
1330 | 3734 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
3735 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 3736 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3737 |
self clearLastActiveMenu. |
1699 | 3738 |
self doUngrab:(superMenu isNil). |
3739 |
"/ self isPopUpView ifTrue:[ |
|
3740 |
"/ self doUngrab:(superMenu isNil) |
|
3741 |
"/ ]. |
|
3742 |
||
388 | 3743 |
super unmap. |
3744 |
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
|
3745 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3746 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3747 |
updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3748 |
"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
|
3749 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3750 |
|bw lvl| |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3751 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3752 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3753 |
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
|
3754 |
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
|
3755 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3756 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3757 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3758 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3759 |
self level:lvl. |
388 | 3760 |
! ! |
3761 |
||
1878 | 3762 |
!MenuPanel methodsFor:'keyboard control'! |
3763 |
||
3764 |
mnemonicViewNext:aKeyEvent |
|
3765 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
3766 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
3767 |
return the topMenu otherwise nil. |
|
3768 |
" |
|
3769 |
|menu uKey lKey list| |
|
3770 |
||
3771 |
superMenu notNil ifTrue:[ |
|
3772 |
^ superMenu mnemonicViewNext:aKeyEvent |
|
3773 |
]. |
|
3774 |
shown ifFalse:[^ nil]. |
|
3775 |
||
3776 |
uKey := aKeyEvent rawKey last asUppercase. |
|
3777 |
lKey := uKey asLowercase. |
|
3778 |
menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu |
|
3779 |
||
3780 |
[true] whileTrue:[ |
|
3781 |
list := menu selectItemIndicesFor:[:el||k|k := el accessCharacter. k == uKey or:[k == lKey]] |
|
3782 |
maxDepth:10. |
|
3783 |
||
3784 |
list size ~~ 0 ifTrue:[ |
|
3785 |
"/ has item which responds to the mnemonic |
|
3786 |
menu processCollectedIndices:list. |
|
3787 |
^ self |
|
3788 |
]. |
|
3789 |
||
3790 |
menu == self ifTrue:[ |
|
3791 |
"/ must clear existing selection |
|
3792 |
self selection:nil. |
|
3793 |
^ nil |
|
3794 |
]. |
|
3795 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3796 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3797 |
! |
1878 | 3798 |
|
3799 |
openMenusFromItemIndices:anItemIndiceList |
|
3800 |
"open all menus derived from sequence of item indices |
|
3801 |
" |
|
3802 |
|item| |
|
3803 |
||
3804 |
anItemIndiceList size == 0 ifTrue:[ |
|
3805 |
^ self |
|
3806 |
]. |
|
3807 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
3808 |
||
3809 |
(item notNil and:[item enabled]) ifTrue:[ |
|
3810 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
|
3811 |
self openMenuOnSelect:true. |
|
3812 |
self selection:item. |
|
3813 |
self openMenuOnSelect:nil. |
|
3814 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3815 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3816 |
! |
1878 | 3817 |
|
3818 |
processCollectedIndices:indices |
|
3819 |
|menu item| |
|
3820 |
||
3821 |
indices size == 0 ifTrue:[ |
|
3822 |
^ self |
|
3823 |
]. |
|
3824 |
menu := self. |
|
3825 |
||
3826 |
[menu selectionIndex == indices first] whileTrue:[ |
|
3827 |
( (item := menu selection) isNil "/ shouldn't happen |
|
3828 |
or:[(menu := item submenu) isNil] "/ no more indices; done |
|
3829 |
) ifTrue:[ |
|
3830 |
^ true |
|
3831 |
]. |
|
3832 |
indices removeFirst. |
|
3833 |
||
3834 |
indices isEmpty ifTrue:[ |
|
3835 |
menu selection:nil. |
|
3836 |
^ self |
|
3837 |
] |
|
3838 |
]. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3839 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3840 |
! |
1878 | 3841 |
|
3842 |
processShortcut:aKeyEvent |
|
3843 |
"a shortcutKey event as forwarded from the keyboardProcessor - if there is the |
|
3844 |
shortcut-key defined process the shortcut and return true otherwise false. |
|
3845 |
" |
|
3846 |
|menu rKey lKey list item winGroup| |
|
3847 |
||
3848 |
superMenu notNil ifTrue:[ |
|
3849 |
^ superMenu processShortcut:aKeyEvent |
|
3850 |
]. |
|
3851 |
shown ifFalse:[^ false]. |
|
3852 |
||
3853 |
item := nil. |
|
3854 |
rKey := aKeyEvent rawKey. |
|
3855 |
lKey := aKeyEvent key. |
|
3856 |
menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu |
|
3857 |
||
3858 |
[true] whileTrue:[ |
|
3859 |
list := menu selectItemIndicesFor:[:el||skey| |
|
3860 |
item := el. |
|
3861 |
skey := el shortcutKey. |
|
3862 |
skey == rKey or:[skey == lKey] |
|
3863 |
] |
|
3864 |
maxDepth:10. |
|
3865 |
||
3866 |
list size ~~ 0 ifTrue:[ |
|
3867 |
"/ has item which responds to the shortcut |
|
3868 |
item hasSubmenu ifFalse:[ |
|
3869 |
menu accept:item |
|
3870 |
] ifTrue:[ |
|
3871 |
menu processCollectedIndices:list. |
|
3872 |
self windowGroup focusView:self. |
|
3873 |
]. |
|
3874 |
^ true |
|
3875 |
]. |
|
3876 |
||
3877 |
menu == self ifTrue:[ ^ false ]. |
|
3878 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3879 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3880 |
! |
1878 | 3881 |
|
3882 |
selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth |
|
3883 |
"returns the sequence of indices up to the item for which the block |
|
3884 |
returns true. The first entry is the topmenu, the last entry the |
|
3885 |
item for which the block returns true. |
|
3886 |
If no item is detected, nil is returned |
|
3887 |
" |
|
3888 |
(maxDepth <= 0 or:[items isNil]) ifTrue:[ |
|
3889 |
^ nil |
|
3890 |
]. |
|
3891 |
||
3892 |
"/ first search horizontal |
|
3893 |
items keysAndValuesDo:[:anIdx :anItem| |
|
3894 |
(aOneArgBlock value:anItem) ifTrue:[ |
|
3895 |
(anItem isEnabled and:[anItem isVisible]) ifTrue:[ |
|
3896 |
^ OrderedCollection with:anIdx. |
|
3897 |
] |
|
3898 |
] |
|
3899 |
]. |
|
3900 |
"/ search in subMenus |
|
3901 |
items keysAndValuesDo:[:anIdx :anItem| |menu seq| |
|
1919
26fa92fa9465
only search submenus for shortCuts if the menu is a static one
Claus Gittinger <cg@exept.de>
parents:
1918
diff
changeset
|
3902 |
(anItem hasSubmenu |
26fa92fa9465
only search submenus for shortCuts if the menu is a static one
Claus Gittinger <cg@exept.de>
parents:
1918
diff
changeset
|
3903 |
and:[anItem isVisible |
26fa92fa9465
only search submenus for shortCuts if the menu is a static one
Claus Gittinger <cg@exept.de>
parents:
1918
diff
changeset
|
3904 |
and:[anItem isEnabled]]) ifTrue:[ |
1878 | 3905 |
menu := anItem submenu. |
3906 |
||
3907 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
|
3908 |
seq := menu selectItemIndicesFor:aOneArgBlock maxDepth:(maxDepth - 1). |
|
3909 |
seq notNil ifTrue:[ |
|
3910 |
seq addFirst:anIdx. |
|
3911 |
^ seq |
|
3912 |
] |
|
3913 |
] |
|
3914 |
] |
|
3915 |
]. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3916 |
^ nil |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3917 |
! ! |
1878 | 3918 |
|
388 | 3919 |
!MenuPanel methodsFor:'misc'! |
3920 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3921 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3922 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3923 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3924 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3925 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3926 |
|
388 | 3927 |
superMenu |
3928 |
"returns supermenu or nil |
|
3929 |
" |
|
3930 |
^ superMenu |
|
3931 |
||
3932 |
||
3933 |
! |
|
3934 |
||
3935 |
superMenu:aSuperMenu |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
3936 |
"set my supermenu from which i'am activated |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
3937 |
" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
3938 |
(superMenu := aSuperMenu) notNil ifTrue:[ |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3939 |
super font:(superMenu font). |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
3940 |
]. |
388 | 3941 |
! |
3942 |
||
3943 |
topMenu |
|
3944 |
"returns the topMenu; the one having no superMenu |
|
3945 |
" |
|
1791 | 3946 |
|menu smenu| |
3947 |
||
3948 |
menu := self. |
|
3949 |
||
3950 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
3951 |
menu := smenu |
|
3952 |
]. |
|
3953 |
^ menu |
|
388 | 3954 |
! ! |
3955 |
||
1825 | 3956 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3957 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3958 |
printString |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3959 |
"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
|
3960 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3961 |
|string label| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3962 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3963 |
string := 'Menu:'. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3964 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3965 |
self do:[:anItem| |
1117 | 3966 |
label := anItem label ? ''. |
3967 |
string := string ,' ', label printString. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3968 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3969 |
^ string |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3970 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3971 |
"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
|
3972 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3973 |
|
388 | 3974 |
!MenuPanel methodsFor:'private'! |
3975 |
||
434 | 3976 |
application |
1613 | 3977 |
"optimize access to retrive the application |
3978 |
" |
|
1921
f3f120d43849
oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents:
1919
diff
changeset
|
3979 |
|appl akey w views| |
434 | 3980 |
|
3981 |
superMenu notNil ifTrue:[ |
|
1613 | 3982 |
^ superMenu application |
3983 |
]. |
|
1870 | 3984 |
|
1613 | 3985 |
akey := #appl. |
3986 |
appl := self menuAdornmentAt:akey. |
|
3987 |
||
3988 |
appl isNil ifTrue:[ |
|
3989 |
(appl := super application) isNil ifTrue:[ |
|
3990 |
windowGroup isNil ifTrue:[ |
|
3991 |
^ nil "/ RETRY LATER |
|
3992 |
]. |
|
1921
f3f120d43849
oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents:
1919
diff
changeset
|
3993 |
views := windowGroup mainGroup topViews. |
f3f120d43849
oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents:
1919
diff
changeset
|
3994 |
views size == 0 ifTrue:[ |
f3f120d43849
oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents:
1919
diff
changeset
|
3995 |
^ nil "/ RETRY LATER |
f3f120d43849
oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents:
1919
diff
changeset
|
3996 |
]. |
f3f120d43849
oops - handle query for application, when view is already closed.
Claus Gittinger <cg@exept.de>
parents:
1919
diff
changeset
|
3997 |
w := views first. |
1870 | 3998 |
w == self ifTrue:[ |
1872 | 3999 |
thisContext isRecursive ifTrue:[ |
4000 |
self error:'recursive application query' |
|
4001 |
]. |
|
4002 |
"/ appl := akey |
|
1870 | 4003 |
]. |
1872 | 4004 |
appl := (w application) ? akey. |
1613 | 4005 |
]. |
4006 |
self menuAdornmentAt:akey put:appl |
|
4007 |
]. |
|
1872 | 4008 |
^ appl ~~ akey ifTrue:[appl] ifFalse:[nil] |
4009 |
! |
|
434 | 4010 |
|
1572 | 4011 |
detectItemForKey:aKey |
4012 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
4013 |
if no item is detected nil is returned. |
|
4014 |
" |
|
4015 |
|cIdx uKey lKey item| |
|
4016 |
||
1699 | 4017 |
items isNil ifTrue:[^ nil]. |
4018 |
||
1572 | 4019 |
cIdx := self selectionIndex. |
4020 |
uKey := aKey asUppercase. |
|
4021 |
lKey := aKey asLowercase. |
|
4022 |
||
1699 | 4023 |
items keysAndValuesDo:[:anIndex :anItem| |char label| |
1572 | 4024 |
( anIndex ~~ cIdx |
4025 |
and:[anItem canSelect |
|
4026 |
and:[(label := anItem textLabel) notNil |
|
4027 |
and:[label size ~~ 0]]] |
|
4028 |
) ifTrue:[ |
|
4029 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4030 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4031 |
^ anItem |
|
4032 |
] |
|
4033 |
] ifFalse:[ |
|
4034 |
char := label at:1. |
|
4035 |
||
4036 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4037 |
anIndex > cIdx ifTrue:[ |
|
4038 |
^ anItem |
|
4039 |
]. |
|
4040 |
item isNil ifTrue:[item := anItem] |
|
4041 |
] |
|
4042 |
] |
|
4043 |
] |
|
4044 |
]. |
|
4045 |
^ item |
|
4046 |
! |
|
4047 |
||
390 | 4048 |
menuAdornmentAt:aSymbol |
388 | 4049 |
"returns a value derived from adornment |
4050 |
" |
|
390 | 4051 |
|adm| |
4052 |
||
4053 |
adm := adornment ? DefaultAdornment. |
|
4054 |
^ adm at:aSymbol ifAbsent:nil |
|
388 | 4055 |
! |
4056 |
||
390 | 4057 |
menuAdornmentAt:aSymbol put:something |
653 | 4058 |
"sets a value for the specific menu; if the value differs to the |
4059 |
current stored value, true is returned otherwise false |
|
388 | 4060 |
" |
653 | 4061 |
(self menuAdornmentAt:aSymbol) == something ifTrue:[ |
1117 | 4062 |
^ false |
653 | 4063 |
]. |
4064 |
adornment isNil ifTrue:[ |
|
1117 | 4065 |
adornment := DefaultAdornment copy |
653 | 4066 |
]. |
4067 |
adornment at:aSymbol put:something. |
|
4068 |
^ true |
|
388 | 4069 |
! |
4070 |
||
4071 |
onEachPerform:aSelector withArgList:aList |
|
4072 |
"on each item perform selector with an argument derived from aList |
|
4073 |
" |
|
4074 |
aList isCollection ifTrue:[ |
|
1117 | 4075 |
items size >= aList size ifTrue:[ |
4076 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4077 |
(items at:anIndex) perform:aSelector with:anArg |
|
4078 |
] |
|
4079 |
] |
|
388 | 4080 |
] ifFalse:[ |
1117 | 4081 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4082 |
] |
4083 |
||
4084 |
||
4085 |
! |
|
4086 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4087 |
registerImageOnDevice:anImage |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4088 |
|image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4089 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4090 |
(image := anImage) notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4091 |
image device ~~ device ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4092 |
image := image copy. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4093 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4094 |
image := image on:device. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4095 |
image := image clearMaskedPixels. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4096 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4097 |
^ image |
388 | 4098 |
! ! |
4099 |
||
687 | 4100 |
!MenuPanel methodsFor:'private activation'! |
4101 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4102 |
activeMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4103 |
"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
|
4104 |
" |
687 | 4105 |
^ lastActiveMenu ? self |
4106 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4107 |
"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
|
4108 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4109 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4110 |
activeMenu:aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4111 |
"set the current active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4112 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4113 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4114 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4115 |
"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
|
4116 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4117 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4118 |
becomesActiveMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4119 |
"submenu becomes the active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4120 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4121 |
mapTime := Time millisecondClockValue. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4122 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4123 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4124 |
"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
|
4125 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4126 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4127 |
clearLastActiveMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4128 |
"reset the current active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4129 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4130 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4131 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4132 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4133 |
|
1612 | 4134 |
prevFocusView notNil ifTrue:[ |
4135 |
self windowGroup focusView:prevFocusView. |
|
4136 |
prevFocusView := nil. |
|
4137 |
]. |
|
4138 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4139 |
top activeMenu == self ifTrue:[ |
1612 | 4140 |
top activeMenu:nil |
687 | 4141 |
] |
4142 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4143 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4144 |
! |
4145 |
||
4146 |
mapTime |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4147 |
"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
|
4148 |
" |
687 | 4149 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4150 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4151 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
687 | 4152 |
! ! |
4153 |
||
2016 | 4154 |
!MenuPanel methodsFor:'private scrolling'! |
4155 |
||
4156 |
hasScrollerAt:aDirection |
|
4157 |
"returns true if a visible scroller at a direction exists |
|
4158 |
" |
|
4159 |
|layout| |
|
4160 |
||
4161 |
self hasScrollers ifFalse:[ |
|
4162 |
^ false |
|
4163 |
]. |
|
4164 |
||
4165 |
aDirection == #PREV ifTrue:[ |
|
4166 |
layout := items first layout. |
|
4167 |
||
4168 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
4169 |
ifFalse:[ layout left < margin] |
|
4170 |
]. |
|
4171 |
layout := items last layout. |
|
4172 |
||
4173 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
4174 |
ifFalse:[ layout right > (width - margin)] |
|
4175 |
! |
|
4176 |
||
4177 |
hasScrollers |
|
4178 |
"returns true if scrollers are needed |
|
4179 |
" |
|
2018 | 4180 |
|maxExtent first last isVert| |
4181 |
||
4182 |
(mustRearrange or:[items size < 2]) ifTrue:[^ false]. |
|
4183 |
||
4184 |
isVert := self verticalLayout. |
|
4185 |
||
4186 |
superView notNil ifTrue:[ |
|
2039 | 4187 |
( (first := items first layout) isNil |
4188 |
or:[(last := items last layout) isNil] |
|
4189 |
) ifTrue:[ |
|
4190 |
^ false |
|
4191 |
]. |
|
2018 | 4192 |
isVert ifTrue:[ |
4193 |
^ first top < 0 or:[last bottom > height] |
|
4194 |
]. |
|
4195 |
^ first left < 0 or:[last right > width] |
|
4196 |
]. |
|
4197 |
maxExtent := self maxExtent. |
|
4198 |
||
4199 |
isVert ifTrue:[ |
|
4200 |
^ (height < maxExtent y) not |
|
4201 |
]. |
|
4202 |
^ (width < maxExtent x) not |
|
2016 | 4203 |
! |
4204 |
||
4205 |
indexOfItemAtScroller:aDirection |
|
4206 |
"returns the index of the item under the scroller or 0 |
|
4207 |
" |
|
4208 |
|bounds min max layout| |
|
4209 |
||
4210 |
bounds := self scrollerBoundsAt:aDirection. |
|
4211 |
||
4212 |
bounds isNil ifTrue:[ |
|
4213 |
^ 0 |
|
4214 |
]. |
|
4215 |
||
4216 |
self verticalLayout ifTrue:[ |
|
4217 |
min := bounds top. |
|
4218 |
max := bounds bottom. |
|
4219 |
||
4220 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4221 |
anItem isVisible ifTrue:[ |
|
4222 |
layout := anItem layout. |
|
4223 |
||
4224 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4225 |
^ anIndex |
|
4226 |
]. |
|
4227 |
]. |
|
4228 |
]. |
|
4229 |
] ifFalse:[ |
|
4230 |
min := bounds left. |
|
4231 |
max := bounds right. |
|
4232 |
||
4233 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4234 |
anItem isVisible ifTrue:[ |
|
4235 |
layout := anItem layout. |
|
4236 |
||
4237 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4238 |
^ anIndex |
|
4239 |
]. |
|
4240 |
]. |
|
4241 |
] |
|
4242 |
]. |
|
4243 |
^ 0 |
|
4244 |
! |
|
4245 |
||
4246 |
makeItemVisible:anItem |
|
4247 |
"make an item visible |
|
4248 |
" |
|
2018 | 4249 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4250 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4251 |
inv1 inv2| |
2018 | 4252 |
|
4253 |
( anItem notNil |
|
4254 |
and:[self hasScrollers |
|
4255 |
and:[(layout := anItem layout) notNil]] |
|
4256 |
) ifFalse:[ |
|
2016 | 4257 |
^ self |
4258 |
]. |
|
2018 | 4259 |
index := self indexOfItem:anItem. |
2016 | 4260 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4261 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4262 |
||
2018 | 4263 |
isVertical := self verticalLayout. |
4264 |
||
4265 |
isVertical ifTrue:[ |
|
4266 |
boundsMin := boundsPREV bottom. |
|
4267 |
boundsMax := boundsNEXT top. |
|
4268 |
layoutMin := layout top. |
|
4269 |
layoutMax := layout bottom. |
|
4270 |
windowSz := height. |
|
4271 |
] ifFalse:[ |
|
4272 |
boundsMin := boundsPREV right. |
|
4273 |
boundsMax := boundsNEXT left. |
|
4274 |
layoutMin := layout left. |
|
4275 |
layoutMax := layout right. |
|
4276 |
windowSz := width. |
|
4277 |
]. |
|
4278 |
||
4279 |
||
4280 |
layoutMin < boundsMin ifTrue:[ |
|
2062 | 4281 |
layoutMin >= 0 ifTrue:[ |
4282 |
^ self |
|
4283 |
]. |
|
2016 | 4284 |
"/ test whether is first visible item |
4285 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
|
4286 |
||
2018 | 4287 |
index == 0 ifTrue:[ scr0 := margin ] |
4288 |
ifFalse:[ scr0 := boundsMin ]. |
|
4289 |
||
4290 |
delta := layoutMin negated + scr0. |
|
2016 | 4291 |
] ifFalse:[ |
2018 | 4292 |
layoutMax > boundsMax ifFalse:[ |
2016 | 4293 |
^ self |
4294 |
]. |
|
4295 |
"/ test whether is last visible item |
|
4296 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
|
4297 |
||
2018 | 4298 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
4299 |
ifFalse:[ scr0 := boundsMax ]. |
|
4300 |
||
4301 |
delta := scr0 - layoutMax. |
|
4302 |
]. |
|
4303 |
delta == 0 ifTrue:[ ^ self ]. |
|
4304 |
||
2016 | 4305 |
doScroll := false. |
4306 |
||
4307 |
shown ifTrue:[ |
|
2018 | 4308 |
delta abs < (windowSz / 2) ifTrue:[ |
2016 | 4309 |
doScroll := true. |
4310 |
self repairDamage |
|
4311 |
] |
|
4312 |
]. |
|
2018 | 4313 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4314 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4315 |
|
4316 |
doScroll ifFalse:[ |
|
4317 |
^ self invalidate |
|
4318 |
]. |
|
4319 |
||
2018 | 4320 |
windowSz := windowSz - margin - margin. |
4321 |
||
4322 |
scr0 := boundsMin. |
|
4323 |
scr1 := scr0 + delta abs. |
|
4324 |
scrSz := boundsMax - scr1. |
|
4325 |
||
4326 |
delta < 0 ifTrue:[ |
|
4327 |
isVertical ifTrue:[ |
|
4328 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
|
2041
00e511a396d0
either invoke catchExpose or do not copy async.
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
4329 |
width:windowSz height:scrSz async:false. |
2018 | 4330 |
|
4331 |
scr1 := scr0 + scrSz. |
|
2042 | 4332 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
4333 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
|
2018 | 4334 |
] ifFalse:[ |
4335 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
|
2041
00e511a396d0
either invoke catchExpose or do not copy async.
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
4336 |
width:scrSz height:windowSz async:false. |
2018 | 4337 |
|
4338 |
scr1 := scr0 + scrSz. |
|
2042 | 4339 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
4340 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
|
2018 | 4341 |
]. |
2042 | 4342 |
inv1 := boundsPREV. |
2016 | 4343 |
] ifFalse:[ |
2018 | 4344 |
isVertical ifTrue:[ |
4345 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
|
2041
00e511a396d0
either invoke catchExpose or do not copy async.
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
4346 |
width:windowSz height:scrSz async:false. |
2018 | 4347 |
|
2042 | 4348 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
4349 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
|
2018 | 4350 |
] ifFalse:[ |
4351 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
|
2041
00e511a396d0
either invoke catchExpose or do not copy async.
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
4352 |
width:scrSz height:windowSz async:false. |
2018 | 4353 |
|
2042 | 4354 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
4355 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
|
2018 | 4356 |
]. |
2042 | 4357 |
inv1 := boundsNEXT. |
4358 |
]. |
|
4359 |
self invalidate:inv1. |
|
4360 |
self invalidate:inv2. |
|
2048 | 4361 |
|
4362 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 4363 |
! |
4364 |
||
4365 |
scrollerBoundsAt:aDirection |
|
4366 |
"returns the bounds of the scroller at a direction or nil |
|
4367 |
" |
|
4368 |
|y x w h inset| |
|
4369 |
||
4370 |
self hasScrollers ifFalse:[ |
|
4371 |
^ nil |
|
4372 |
]. |
|
4373 |
inset := 0. |
|
4374 |
x := y := inset. |
|
4375 |
w := h := 15. |
|
4376 |
||
4377 |
self verticalLayout ifTrue:[ |
|
4378 |
aDirection == #NEXT ifTrue:[ |
|
4379 |
y := height - h - inset. |
|
4380 |
]. |
|
4381 |
w := width - inset - inset. |
|
4382 |
] ifFalse:[ |
|
4383 |
aDirection == #NEXT ifTrue:[ |
|
4384 |
x := width - w - inset. |
|
4385 |
]. |
|
4386 |
h := height - inset - inset. |
|
4387 |
]. |
|
4388 |
^ Rectangle left:x top:y width:w height:h |
|
4389 |
! |
|
4390 |
||
2046 | 4391 |
scrollerDirectionAtPoint:aPoint |
4392 |
"returns the scroller-direction at aPoint, or nil |
|
4393 |
" |
|
4394 |
self hasScrollers ifTrue:[ |
|
4395 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
|
4396 |
( (bounds := self scrollerBoundsAt:aDirection) notNil |
|
4397 |
and:[bounds containsPoint:aPoint] |
|
4398 |
) ifTrue:[ |
|
4399 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
|
4400 |
] |
|
4401 |
] |
|
4402 |
]. |
|
4403 |
^ nil |
|
4404 |
||
4405 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
4406 |
! |
|
4407 |
||
2016 | 4408 |
scrolling |
4409 |
"returns the one and only scrolling - data holder |
|
4410 |
for a menu and all contained submenus |
|
4411 |
" |
|
4412 |
superMenu notNil ifTrue:[ |
|
4413 |
^ superMenu scrolling |
|
4414 |
]. |
|
4415 |
scrolling isNil ifTrue:[ |
|
4416 |
scrolling := Scrolling new. |
|
4417 |
]. |
|
4418 |
^ scrolling |
|
4419 |
! ! |
|
4420 |
||
388 | 4421 |
!MenuPanel methodsFor:'private searching'! |
4422 |
||
1699 | 4423 |
detectGrabMenu |
4424 |
"returns the menu which is responsible for the grap; the last opened menu |
|
4425 |
" |
|
4426 |
|subMenu| |
|
4427 |
||
4428 |
selection notNil ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4429 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
1699 | 4430 |
^ subMenu detectGrabMenu |
4431 |
] |
|
4432 |
]. |
|
4433 |
^ self |
|
4434 |
! |
|
4435 |
||
4436 |
detectMenuAtGrabPoint:aGrabPoint |
|
4437 |
"returns the menu which contains the grab-point |
|
4438 |
" |
|
4439 |
|dstMenu dstPoint firstMenu| |
|
4440 |
||
4441 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
4442 |
||
4443 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
4444 |
firstMenu := self. |
|
4445 |
]. |
|
4446 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4447 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
1699 | 4448 |
^ firstMenu |
4449 |
]. |
|
4450 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 4451 |
^ dstMenu ? firstMenu |
1699 | 4452 |
! |
4453 |
||
1767 | 4454 |
detectViewAtX:x y:y in:aTopView |
1922 | 4455 |
"detect view at x@y |
4456 |
" |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4457 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4458 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4459 |
"/ 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
|
4460 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4461 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4462 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4463 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4464 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4465 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4466 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4467 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4468 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4469 |
"/ 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
|
4470 |
"/ ^ 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
|
4471 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4472 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4473 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4474 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4475 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4476 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4477 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 4478 |
! |
4479 |
||
2046 | 4480 |
itemAtPoint:aPoint |
4481 |
"returns the item at a point x@y or nil if none detected |
|
4482 |
" |
|
4483 |
items notNil ifTrue:[ |
|
4484 |
^ items detect:[:el| el containsPoint:aPoint] ifNone:nil |
|
4485 |
]. |
|
4486 |
^ nil |
|
4487 |
||
4488 |
"Created: / 13.11.2001 / 13:58:23 / cg" |
|
4489 |
! |
|
4490 |
||
388 | 4491 |
itemAtX:x y:y |
1699 | 4492 |
"returns the item at a point x@y or nil if none detected |
4493 |
" |
|
4494 |
items notNil ifTrue:[ |
|
4495 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
|
4496 |
]. |
|
4497 |
^ nil |
|
388 | 4498 |
! |
4499 |
||
2048 | 4500 |
superMenuAtPoint:aPoint |
4501 |
"returns the superMenu which contains aPoint, or nil if none detected |
|
1699 | 4502 |
" |
4503 |
|grabPoint superMenu| |
|
4504 |
||
2048 | 4505 |
(self containsPoint:aPoint) ifTrue:[ |
1699 | 4506 |
^ self |
4507 |
]. |
|
4508 |
||
2048 | 4509 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 4510 |
superMenu := self. |
4511 |
||
4512 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
4513 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
|
4514 |
^ superMenu |
|
4515 |
] |
|
388 | 4516 |
]. |
4517 |
^ nil |
|
1699 | 4518 |
|
2048 | 4519 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 4520 |
! ! |
4521 |
||
4522 |
!MenuPanel methodsFor:'queries'! |
|
4523 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4524 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4525 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4526 |
aView notNil ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4527 |
"/ I am no longer a popUpView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4528 |
self updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4529 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4530 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4531 |
|
388 | 4532 |
containsPoint:aPoint |
4533 |
"returns true if point is contained by the view |
|
4534 |
" |
|
4535 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
|
4536 |
! |
|
4537 |
||
4538 |
containsPointX:x y:y |
|
4539 |
"returns true if point is contained by the view |
|
4540 |
" |
|
708 | 4541 |
^ (x between:0 and:width) and:[y between:0 and:height] |
879 | 4542 |
|
388 | 4543 |
! |
4544 |
||
390 | 4545 |
hasGroupDividerAt:anIndex |
388 | 4546 |
"returns true if a divider is defined at an index |
4547 |
" |
|
4548 |
|i| |
|
4549 |
||
4550 |
groupSizes size ~~ 0 ifTrue:[ |
|
1699 | 4551 |
i := 0. |
4552 |
||
4553 |
groupSizes do:[:t| |
|
4554 |
(i := i + t) == anIndex ifTrue:[ |
|
4555 |
^ true |
|
4556 |
] |
|
4557 |
] |
|
388 | 4558 |
]. |
4559 |
^ false |
|
4560 |
||
4561 |
! |
|
4562 |
||
390 | 4563 |
hasGroupDividers |
4564 |
"returns true if any group divider exists |
|
4565 |
" |
|
4566 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
4567 |
! |
|
4568 |
||
388 | 4569 |
isEnabled |
4570 |
"returns enabled state of menu and items |
|
4571 |
" |
|
4572 |
^ self enabled |
|
4573 |
! |
|
4574 |
||
390 | 4575 |
isFitPanel |
4576 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 4577 |
be fit to the extent of its superView; |
4578 |
NOT SUPPORTED |
|
4579 |
" |
|
4580 |
^ false |
|
390 | 4581 |
! |
4582 |
||
388 | 4583 |
isPopUpView |
4584 |
"return true if view is a popup view; without decoration |
|
4585 |
and popUp to top immediately |
|
4586 |
" |
|
4587 |
^ superView isNil |
|
4588 |
||
4589 |
||
4590 |
! |
|
4591 |
||
4592 |
isVerticalLayout |
|
4593 |
"returns true if vertical layout otherwise false( horizontal layout ) |
|
4594 |
" |
|
1699 | 4595 |
^ self verticalLayout |
388 | 4596 |
|
4597 |
||
416 | 4598 |
! |
4599 |
||
1793 | 4600 |
isViewWrapper |
4601 |
^ subViews size ~~ 0 |
|
4602 |
! |
|
4603 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4604 |
openMenuOnSelect |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4605 |
^ (self menuAdornmentAt:#openMenuOnSelect) ? DefaultOpenOnSelect. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4606 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4607 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4608 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4609 |
openMenuOnSelect:something |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4610 |
^ self menuAdornmentAt:#openMenuOnSelect put:something |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4611 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4612 |
|
2061 | 4613 |
select:newSel openMenu:openMenu |
4614 |
|old| |
|
4615 |
||
4616 |
old := self menuAdornmentAt:#openMenuOnSelect. |
|
4617 |
self menuAdornmentAt:#openMenuOnSelect put:openMenu. |
|
4618 |
self selection:newSel. |
|
4619 |
self menuAdornmentAt:#openMenuOnSelect put:old. |
|
4620 |
! |
|
4621 |
||
416 | 4622 |
type |
428 | 4623 |
^ nil. |
416 | 4624 |
|
388 | 4625 |
! ! |
4626 |
||
4627 |
!MenuPanel methodsFor:'selection'! |
|
4628 |
||
4629 |
hasSelection |
|
4630 |
"returns true if a selection exists |
|
4631 |
" |
|
4632 |
^ self selection notNil |
|
4633 |
! |
|
4634 |
||
4635 |
selection |
|
4636 |
"returns current selected item or nil |
|
4637 |
" |
|
4638 |
^ selection |
|
4639 |
||
4640 |
||
4641 |
! |
|
4642 |
||
4643 |
selection:anItemOrNil |
|
2016 | 4644 |
"change selection to an item or nil |
4645 |
" |
|
4646 |
|item newSel hlp visItem| |
|
388 | 4647 |
|
1572 | 4648 |
(newSel := anItemOrNil) isNumber ifTrue:[ |
4649 |
newSel := self itemAt:anItemOrNil |
|
4650 |
]. |
|
2016 | 4651 |
visItem := newSel. |
4652 |
||
1572 | 4653 |
(newSel notNil and:[newSel canSelect]) ifFalse:[ |
4654 |
newSel := nil |
|
388 | 4655 |
]. |
4656 |
||
2016 | 4657 |
selection == newSel ifTrue:[ |
4658 |
^ self |
|
4659 |
]. |
|
388 | 4660 |
|
4661 |
(item := selection) notNil ifTrue:[ |
|
1572 | 4662 |
selection := nil. |
4663 |
item selected:false. |
|
388 | 4664 |
]. |
2048 | 4665 |
visItem notNil ifTrue:[self makeItemVisible:visItem]. |
2016 | 4666 |
|
4667 |
newSel isNil ifTrue:[^ self]. |
|
4668 |
||
4669 |
newSel == enteredItem ifTrue:[ |
|
4670 |
enteredItem := nil |
|
4671 |
] ifFalse:[ |
|
4672 |
self pointerEntersItem:nil |
|
4673 |
]. |
|
4674 |
selection := newSel. |
|
4675 |
||
4676 |
ActiveHelp isActive ifTrue:[ |
|
4677 |
hlp := ActiveHelp currentHelpListener. |
|
2058 | 4678 |
hlp initiateHelpFor:self at:nil now:true. |
2016 | 4679 |
]. |
4680 |
shown "realized" ifTrue:[self rearrangeItems]. |
|
4681 |
selection selected:true. |
|
2048 | 4682 |
|
4683 |
"Modified: / 13.11.2001 / 20:17:47 / cg" |
|
388 | 4684 |
! |
4685 |
||
4686 |
selectionIndex |
|
4687 |
"returns index of current selection or 0 |
|
4688 |
" |
|
4689 |
|item| |
|
4690 |
||
4691 |
(item := self selection) notNil ifTrue:[ |
|
1117 | 4692 |
^ self findFirst:[:el| el == item ] |
388 | 4693 |
]. |
4694 |
^ 0 |
|
4695 |
||
4696 |
! |
|
4697 |
||
4698 |
selectionIndex:anIndex |
|
4699 |
"set selection at an index |
|
4700 |
" |
|
4701 |
self selection:(self itemAt:anIndex) |
|
4702 |
! ! |
|
4703 |
||
1791 | 4704 |
!MenuPanel methodsFor:'translation'! |
4705 |
||
4706 |
translateGrabPoint:aGrabPoint |
|
4707 |
"translate the grab point into self |
|
4708 |
" |
|
4709 |
superMenu isNil ifTrue:[ |
|
4710 |
"I am the grapView" |
|
4711 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
4712 |
^ aGrabPoint |
|
4713 |
]. |
|
4714 |
||
4715 |
relativeGrabOrigin isNil ifTrue:[ |
|
4716 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
|
4717 |
]. |
|
4718 |
^ relativeGrabOrigin + aGrabPoint |
|
4719 |
||
4720 |
! |
|
4721 |
||
4722 |
translateMenuPoint:aPoint toMenu:aMenu |
|
4723 |
"translate a point into another menu its point |
|
4724 |
" |
|
4725 |
|grapPoint| |
|
4726 |
||
4727 |
aMenu == self ifTrue:[ |
|
4728 |
^ aPoint |
|
4729 |
]. |
|
4730 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
4731 |
||
4732 |
^ aMenu translateGrabPoint:grapPoint |
|
4733 |
||
4734 |
! |
|
4735 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4736 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4737 |
"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
|
4738 |
" |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4739 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4740 |
^ device |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4741 |
translatePoint:aPoint asPoint |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4742 |
fromView:self |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4743 |
toView:anotherWindowOrNilForScreen |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4744 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4745 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 4746 |
! ! |
4747 |
||
388 | 4748 |
!MenuPanel::Item class methodsFor:'accessing'! |
4749 |
||
689 | 4750 |
horizontalInset |
4751 |
^ HorizontalInset |
|
4752 |
! |
|
4753 |
||
388 | 4754 |
labelRightOffset |
4755 |
^ LabelRightOffset |
|
4756 |
! |
|
4757 |
||
689 | 4758 |
verticalInset |
4759 |
^ VerticalInset |
|
1765 | 4760 |
! |
4761 |
||
4762 |
verticalPopUpInset |
|
4763 |
^ VerticalPopUpInset |
|
388 | 4764 |
! ! |
4765 |
||
616 | 4766 |
!MenuPanel::Item class methodsFor:'defaults'! |
4767 |
||
1699 | 4768 |
separatorSize |
616 | 4769 |
"returns size of a separator |
4770 |
" |
|
1699 | 4771 |
^ 10 |
616 | 4772 |
! |
4773 |
||
4774 |
updateStyleCache |
|
388 | 4775 |
"setup defaults |
650 | 4776 |
self updateStyleCache |
388 | 4777 |
" |
1765 | 4778 |
<resource: #style (#'menuPanel.verticalInset')> |
4779 |
||
1699 | 4780 |
HorizontalInset := 2. |
1765 | 4781 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
4782 |
VerticalPopUpInset := 2. |
|
727 | 4783 |
|
4784 |
HorizontalButtonInset := 3. |
|
4785 |
VerticalButtonInset := 3. |
|
4786 |
||
681 | 4787 |
LabelRightOffset := 15. |
1765 | 4788 |
|
4789 |
||
1124 | 4790 |
! ! |
1078 | 4791 |
|
388 | 4792 |
!MenuPanel::Item class methodsFor:'instance creation'! |
4793 |
||
4794 |
in:aSuperMenu |
|
4795 |
^ self in:aSuperMenu label:nil |
|
4796 |
! |
|
4797 |
||
4798 |
in:aSuperMenu label:aLabel |
|
4799 |
|item| |
|
4800 |
||
4801 |
item := self new in:aSuperMenu. |
|
4802 |
item label:aLabel. |
|
4803 |
^ item |
|
4804 |
! |
|
4805 |
||
4806 |
in:aSuperMenu menuItem:aMenuItem |
|
4807 |
|item| |
|
4808 |
||
4809 |
item := self in:aSuperMenu. |
|
4810 |
item menuItem:aMenuItem. |
|
4811 |
^ item. |
|
4812 |
! ! |
|
4813 |
||
1808 | 4814 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 4815 |
|
420 | 4816 |
canAccept |
4817 |
"returns true if item is acceptable |
|
4818 |
" |
|
4819 |
^ (self enabled and:[self hasSubmenu not]) |
|
524 | 4820 |
! |
4821 |
||
4822 |
toggleIndication |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4823 |
"toggle indication or choice |
524 | 4824 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4825 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4826 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4827 |
indication notNil ifTrue:[ |
1699 | 4828 |
arg := self indicationValue not. |
4829 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4830 |
] ifFalse:[ |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4831 |
choice notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4832 |
choice value:choiceValue. |
1699 | 4833 |
^ true |
4834 |
] |
|
524 | 4835 |
]. |
4836 |
^ arg |
|
389 | 4837 |
! ! |
4838 |
||
388 | 4839 |
!MenuPanel::Item methodsFor:'accessing'! |
4840 |
||
4841 |
accessCharacter |
|
389 | 4842 |
"returns my accessCharacter or nil |
388 | 4843 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4844 |
^ accessCharacter |
388 | 4845 |
! |
4846 |
||
4847 |
accessCharacterPosition |
|
390 | 4848 |
"get the access character position or nil |
388 | 4849 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4850 |
^ accessCharacterPosition |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4851 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4852 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4853 |
accessCharacterPosition:anIndex |
390 | 4854 |
"set the access character position or nil |
388 | 4855 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4856 |
accessCharacterPosition := anIndex. |
388 | 4857 |
! |
4858 |
||
4859 |
argument |
|
4860 |
"gets the argument |
|
4861 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4862 |
^ argument |
388 | 4863 |
! |
4864 |
||
4865 |
argument:anArgument |
|
4866 |
"sets the argument |
|
4867 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4868 |
argument := anArgument. |
389 | 4869 |
! |
4870 |
||
1727 | 4871 |
font |
4872 |
"returns the user configured font or nil (default menu font) |
|
4873 |
" |
|
4874 |
^ font |
|
4875 |
! |
|
4876 |
||
4877 |
font:aFont |
|
4878 |
"returns the user configured font or nil (default menu font) |
|
4879 |
" |
|
4880 |
aFont ~= font ifTrue:[ |
|
4881 |
font := aFont notNil ifTrue:[aFont onDevice:(menuPanel device)] |
|
4882 |
ifFalse:[nil]. |
|
4883 |
||
4884 |
rawLabel notNil ifTrue:[ |
|
4885 |
"have to recompute the extent" |
|
4886 |
self label:label |
|
4887 |
] |
|
4888 |
]. |
|
4889 |
! |
|
4890 |
||
388 | 4891 |
label |
4892 |
"returns the label |
|
4893 |
" |
|
4894 |
^ label |
|
4895 |
! |
|
4896 |
||
4897 |
label:aLabel |
|
399 | 4898 |
"set a new label; if the label changed, a redraw is performed; |
4899 |
handle characters $& (ST-80 compatibility) |
|
388 | 4900 |
" |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4901 |
|size char lbl mfont f oldExtent |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4902 |
h "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4903 |
w "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4904 |
| |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4905 |
oldExtent := rawLabelExtent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4906 |
accessCharacter := rawLabelExtent := disabledRawLabel := nil. |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4907 |
label := aLabel value. |
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4908 |
rawLabel := label value ? ''. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4909 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4910 |
rawLabel isString ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4911 |
"CHECK FOR SEPARATOR" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4912 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4913 |
(isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4914 |
size := rawLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4915 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4916 |
size == 0 ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4917 |
rawLabel := nil. "blank separator" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4918 |
^ self |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4919 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4920 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4921 |
size == 1 ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4922 |
char := rawLabel first. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4923 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4924 |
(char == $- or:[char == $=]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4925 |
label := rawLabel. "line separator" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4926 |
rawLabel := nil. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4927 |
^ self |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4928 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4929 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4930 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4931 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4932 |
rawLabel isCollection ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4933 |
rawLabel := rawLabel asArray. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4934 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4935 |
]. |
1727 | 4936 |
mfont := menuPanel setFont:font. |
4937 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4938 |
rawLabel isArray ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4939 |
w := h := 0. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4940 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4941 |
rawLabel keysAndValuesDo:[:i :el| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4942 |
el notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4943 |
lbl := self updateAccessCharacterFor:el. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4944 |
rawLabel at:i put:lbl. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4945 |
w := w max:(lbl widthOn:menuPanel). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4946 |
h := h + 1 + (lbl heightOn:menuPanel). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4947 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4948 |
h := h + 3 |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4949 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4950 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4951 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4952 |
rawLabel := self updateAccessCharacterFor:rawLabel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4953 |
w := rawLabel widthOn:menuPanel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4954 |
h := rawLabel heightOn:menuPanel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4955 |
]. |
1797
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
4956 |
|
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
4957 |
"/ care for italic fonts - give a few more pixels at the end |
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
4958 |
f := mfont ? (menuPanel font). |
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
4959 |
(f notNil and:[f italic]) ifTrue:[ |
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
4960 |
w := w + 2. |
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
4961 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4962 |
rawLabelExtent := w@h. |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4963 |
|
1727 | 4964 |
menuPanel setFont:mfont. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4965 |
menuPanel shown ifTrue:[ self fetchImages ]. |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4966 |
|
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4967 |
oldExtent = rawLabelExtent ifTrue:[ |
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4968 |
self invalidate |
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4969 |
] ifFalse:[ |
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4970 |
menuPanel mustRearrange |
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
4971 |
]. |
388 | 4972 |
! |
4973 |
||
4974 |
menuPanel |
|
4975 |
"returns my menuPanel |
|
4976 |
" |
|
399 | 4977 |
^ menuPanel |
388 | 4978 |
! |
4979 |
||
4980 |
nameKey |
|
4981 |
"gets the nameKey |
|
4982 |
" |
|
4983 |
^ nameKey |
|
4984 |
! |
|
4985 |
||
4986 |
nameKey:aNameKey |
|
4987 |
"sets the nameKey |
|
4988 |
" |
|
4989 |
nameKey := aNameKey. |
|
4990 |
! |
|
4991 |
||
4992 |
rawLabel |
|
390 | 4993 |
"returns my printable Label |
388 | 4994 |
" |
4995 |
^ rawLabel |
|
4996 |
! |
|
4997 |
||
4998 |
shortcutKey |
|
4999 |
"get the key to press to select the submenu from the keyboard or if |
|
5000 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5001 |
" |
|
1609 | 5002 |
^ shortcutKey |
388 | 5003 |
! |
5004 |
||
5005 |
shortcutKey:aKey |
|
5006 |
"set the key to press to select the submenu from the keyboard or if |
|
5007 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5008 |
" |
|
1609 | 5009 |
shortcutKey ~~ aKey ifTrue:[ |
5010 |
shortcutKey := aKey. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5011 |
self invalidate. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5012 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5013 |
! |
388 | 5014 |
|
710 | 5015 |
startGroup |
5016 |
"start group #left #right #center ... or nil |
|
5017 |
at the moment only #right is implemented |
|
5018 |
" |
|
5019 |
^ startGroup |
|
5020 |
! |
|
5021 |
||
5022 |
startGroup:aSymbol |
|
5023 |
"start group #left #right #center ... |
|
5024 |
at the moment only #right is implemented |
|
5025 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5026 |
startGroup := aSymbol. |
710 | 5027 |
! |
5028 |
||
388 | 5029 |
submenu |
5030 |
"returns my submenu or nil |
|
5031 |
" |
|
464 | 5032 |
subMenu notNil ifTrue:[^ subMenu]. |
5033 |
^ self setupSubmenu |
|
388 | 5034 |
! |
5035 |
||
5036 |
submenu:aSubMenu |
|
5037 |
"set a new submenu; an existing submenu will be destroyed. This might lead |
|
5038 |
to a redraw if 'hasSubmenu' changed |
|
5039 |
" |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5040 |
|widget| |
1767 | 5041 |
|
5042 |
aSubMenu isNil ifTrue:[ |
|
5043 |
subMenu notNil ifTrue:[ |
|
5044 |
subMenu destroy. |
|
5045 |
subMenu := nil. |
|
5046 |
]. |
|
5047 |
^ self |
|
5048 |
]. |
|
5049 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5050 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
1767 | 5051 |
subMenu := MenuPanel new. |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5052 |
|
1767 | 5053 |
menuPanel notNil ifTrue:[ |
5054 |
subMenu receiver:menuPanel receiver. |
|
5055 |
]. |
|
5056 |
subMenu superMenu:menuPanel. |
|
5057 |
subMenu menu:aSubMenu. |
|
5058 |
] ifFalse:[ |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5059 |
aSubMenu isView ifFalse:[ |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5060 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5061 |
"/ ... mhhhh .... |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5062 |
^ self submenuChannel:aSubMenu |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5063 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5064 |
widget := SimpleView new. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5065 |
widget client:aSubMenu. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5066 |
] ifTrue:[ |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5067 |
widget := aSubMenu |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5068 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5069 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5070 |
(widget isKindOf:MenuPanel) ifTrue:[ |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5071 |
subMenu := widget |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5072 |
] ifFalse:[ |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5073 |
subMenu := MenuPanel new. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5074 |
subMenu receiver:menuPanel receiver. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5075 |
subMenu addSubView:widget. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5076 |
subMenu extent:(widget preferredExtent). |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5077 |
widget origin:0.0@0.0 corner:1.0@1.0. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5078 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5079 |
subMenu superMenu:menuPanel. |
1929 | 5080 |
]. |
5081 |
self keepLinkedMenu ifTrue:[ |
|
5082 |
submenuChannel := nil |
|
5083 |
] |
|
389 | 5084 |
! |
5085 |
||
390 | 5086 |
textLabel |
5087 |
"returns my textLabel or nil if none text |
|
5088 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5089 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5090 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5091 |
rawLabel notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5092 |
rawLabel isArray ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5093 |
^ rawLabel perform:#string ifNotUnderstood:nil |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5094 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5095 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5096 |
rawLabel do:[:el| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5097 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5098 |
^ txt |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5099 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5100 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5101 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5102 |
^ nil |
1699 | 5103 |
|
390 | 5104 |
! |
5105 |
||
1841 | 5106 |
triggerOnDown |
5107 |
"trigger the action if pressed |
|
5108 |
" |
|
5109 |
triggerOnDown == true ifTrue:[ |
|
5110 |
self hasSubmenu ifFalse:[^ true]. |
|
5111 |
triggerOnDown := false. |
|
5112 |
]. |
|
5113 |
^ false |
|
5114 |
! |
|
5115 |
||
5116 |
triggerOnDown:aBool |
|
5117 |
"trigger the action if pressed |
|
5118 |
" |
|
5119 |
triggerOnDown := aBool. |
|
5120 |
! |
|
5121 |
||
389 | 5122 |
value |
5123 |
"gets value |
|
5124 |
" |
|
5125 |
^ value |
|
5126 |
! |
|
5127 |
||
5128 |
value:something |
|
5129 |
"could be a value holder, an action or selector |
|
5130 |
" |
|
5131 |
value := something. |
|
502 | 5132 |
! |
5133 |
||
5134 |
value:aValue argument:anArgument |
|
5135 |
"set the value and an argument |
|
5136 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5137 |
value := aValue. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5138 |
argument := anArgument. |
388 | 5139 |
! ! |
5140 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5141 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5142 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5143 |
choice |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5144 |
"implements a radio group; the field |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5145 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5146 |
^ choice |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5147 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5148 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5149 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5150 |
choice:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5151 |
"set choice indication |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5152 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5153 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5154 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5155 |
choice isValueModel ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5156 |
choice removeDependent:self |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5157 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5158 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5159 |
(choice := something) notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5160 |
choice isSymbol ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5161 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5162 |
choice := something |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5163 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5164 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5165 |
choice isValueModel ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5166 |
choice addDependent:self |
1699 | 5167 |
] |
5168 |
]. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5169 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5170 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5171 |
choiceValue |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5172 |
"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
|
5173 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5174 |
^ choiceValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5175 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5176 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5177 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5178 |
choiceValue:something |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5179 |
"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
|
5180 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5181 |
choiceValue ~= something ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5182 |
choiceValue := something. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5183 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5184 |
choice notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5185 |
self invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5186 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5187 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5188 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5189 |
|
388 | 5190 |
enabled |
5191 |
"returns the enabled state |
|
5192 |
" |
|
524 | 5193 |
|state| |
5194 |
||
5195 |
menuPanel enabled ifTrue:[ |
|
1699 | 5196 |
enableChannel isSymbol ifTrue:[ |
5197 |
state := self aspectAt:enableChannel. |
|
1806
5ca7e602ca7c
ignore Backspace in shortKey processing;
Claus Gittinger <cg@exept.de>
parents:
1800
diff
changeset
|
5198 |
state isNil ifTrue:[ |
1902 | 5199 |
('MenuPanel::Item [info]: no aspect for ',enableChannel, ' (in ' , (label?rawLabel) printString , ')') infoPrintCR |
1806
5ca7e602ca7c
ignore Backspace in shortKey processing;
Claus Gittinger <cg@exept.de>
parents:
1800
diff
changeset
|
5200 |
]. |
1699 | 5201 |
state isValueModel ifTrue:[ |
5202 |
enableChannel := state. |
|
5203 |
enableChannel addDependent:self. |
|
5204 |
state := enableChannel value. |
|
5205 |
] ifFalse:[ |
|
5206 |
state := state value |
|
5207 |
] |
|
5208 |
] ifFalse:[ |
|
5209 |
state := enableChannel value |
|
5210 |
]. |
|
524 | 5211 |
^ state ~~ false |
460 | 5212 |
]. |
524 | 5213 |
^ false |
388 | 5214 |
! |
5215 |
||
389 | 5216 |
enabled:something |
388 | 5217 |
"change the enabled state; if the state changed, a redraw is performed |
5218 |
" |
|
390 | 5219 |
|oldState newState| |
5220 |
||
5221 |
enableChannel isNil ifTrue:[ |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5222 |
oldState := true |
390 | 5223 |
] ifFalse:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5224 |
oldState := enableChannel value. |
1699 | 5225 |
enableChannel isValueModel ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5226 |
enableChannel removeDependent:self |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5227 |
] |
388 | 5228 |
]. |
390 | 5229 |
enableChannel := something. |
5230 |
||
5231 |
enableChannel isNil ifTrue:[ |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5232 |
menuPanel shown ifFalse:[^ self]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5233 |
newState := true |
390 | 5234 |
] ifFalse:[ |
1699 | 5235 |
enableChannel isValueModel ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5236 |
enableChannel addDependent:self |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5237 |
] ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5238 |
enableChannel isSymbol ifTrue:[^ self] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5239 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5240 |
menuPanel shown ifFalse:[^ self]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5241 |
newState := enableChannel value. |
390 | 5242 |
]. |
5243 |
||
5244 |
newState ~~ oldState ifTrue:[ |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5245 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5246 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5247 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5248 |
|
1670 | 5249 |
hideMenuOnActivated |
5250 |
"hide the menu when the item was activated; the default is true |
|
5251 |
" |
|
5252 |
^ hideMenuOnActivated ? true |
|
5253 |
||
5254 |
! |
|
5255 |
||
5256 |
hideMenuOnActivated:aBool |
|
5257 |
"hide the menu when the item was activated; the default is true |
|
5258 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5259 |
hideMenuOnActivated := aBool. |
1670 | 5260 |
|
5261 |
||
5262 |
! |
|
5263 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5264 |
indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5265 |
"get on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5266 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5267 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5268 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5269 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5270 |
indication:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5271 |
"set on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5272 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5273 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5274 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5275 |
indication isValueModel ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5276 |
indication removeDependent:self |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5277 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5278 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5279 |
(indication := something) notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5280 |
indication isValueModel ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5281 |
indication addDependent:self |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5282 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5283 |
"/ to force an update of the value |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5284 |
self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5285 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5286 |
]. |
464 | 5287 |
! |
5288 |
||
650 | 5289 |
isButton |
5290 |
"returns whether item looks like a Button |
|
5291 |
" |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5292 |
^ isButton |
650 | 5293 |
! |
5294 |
||
5295 |
isButton:anBoolean |
|
5296 |
"sets whether item looks like a Button |
|
5297 |
" |
|
5298 |
isButton := anBoolean. |
|
5299 |
||
1045 | 5300 |
layout notNil ifTrue:[ |
1731 | 5301 |
self invalidate. |
1045 | 5302 |
] |
650 | 5303 |
|
5304 |
||
5305 |
||
5306 |
! |
|
5307 |
||
1767 | 5308 |
keepLinkedMenu |
5309 |
"get the keepLinkedMenu flag |
|
5310 |
" |
|
5311 |
^ keepLinkedMenu ? false |
|
5312 |
! |
|
5313 |
||
5314 |
keepLinkedMenu:aFlag |
|
5315 |
"get the keepLinkedMenu flag |
|
5316 |
" |
|
5317 |
keepLinkedMenu := aFlag |
|
5318 |
! |
|
5319 |
||
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
5320 |
showBusyCursorWhilePerforming |
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
5321 |
"get the flag which controls if a busy cursor is to be shown |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5322 |
while performing the menu action. Defaults to false. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5323 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5324 |
^ showBusyCursorWhilePerforming ? false |
1699 | 5325 |
|
5326 |
||
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
5327 |
! |
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
5328 |
|
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
5329 |
showBusyCursorWhilePerforming:aBoolean |
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
5330 |
"set/clear the flag which controls if a busy cursor is to be shown |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5331 |
while performing the menu action. Defaults to false. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5332 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5333 |
showBusyCursorWhilePerforming := aBoolean. |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
5334 |
! |
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
5335 |
|
464 | 5336 |
submenuChannel |
5337 |
"get the submenu channel |
|
5338 |
" |
|
5339 |
^ submenuChannel |
|
5340 |
! |
|
5341 |
||
5342 |
submenuChannel:aSelectorOrNil |
|
5343 |
"returns the submenu channel |
|
5344 |
" |
|
5345 |
submenuChannel := aSelectorOrNil. |
|
388 | 5346 |
! ! |
5347 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5348 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 5349 |
|
5350 |
layout |
|
5351 |
"returns my layout ( Rectangle ) |
|
5352 |
" |
|
5353 |
^ layout |
|
5354 |
! |
|
5355 |
||
5356 |
layout:aLayout |
|
5357 |
"set a new layout ( Rectangle ) |
|
5358 |
" |
|
5359 |
layout := aLayout. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5360 |
self invalidate. |
1692 | 5361 |
|
388 | 5362 |
! |
5363 |
||
2016 | 5364 |
moveBy:aPoint |
5365 |
"move layout origin |
|
5366 |
" |
|
5367 |
layout moveBy:aPoint. |
|
5368 |
! |
|
5369 |
||
1699 | 5370 |
preferredExtent |
5371 |
"compute my preferred extent excluding the shortCutKey and the menu identifier |
|
5372 |
" |
|
5373 |
|isVertical |
|
5374 |
x "{ Class:SmallInteger }" |
|
5375 |
y "{ Class:SmallInteger }" |
|
5376 |
s "{ Class:SmallInteger }" |
|
5377 |
| |
|
5378 |
self isVisible ifFalse:[^ 0@0 ]. |
|
5379 |
||
5380 |
isButton ifTrue:[ |
|
5381 |
s := menuPanel maxAbsoluteButtonLevel. |
|
5382 |
x := s + HorizontalButtonInset. |
|
5383 |
y := s + VerticalButtonInset. |
|
5384 |
] ifFalse:[ |
|
5385 |
x := HorizontalInset. |
|
1766
e3667c5b8b30
may not assign potential nil to a smallInt-typed variable
Claus Gittinger <cg@exept.de>
parents:
1765
diff
changeset
|
5386 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 5387 |
]. |
5388 |
x := x * 2. |
|
5389 |
y := y * 2. |
|
5390 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5391 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5392 |
|
1699 | 5393 |
rawLabel isNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5394 |
"SEPARATOR" |
1699 | 5395 |
s := self class separatorSize. |
5396 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5397 |
"width of doubleSeparator is 5 !!!!" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5398 |
isVertical ifFalse:[ |
1699 | 5399 |
x := x max:s. |
5400 |
y := y + 5. |
|
5401 |
] ifTrue:[ |
|
5402 |
y := y max:s. |
|
5403 |
x := x + 5. |
|
5404 |
]. |
|
5405 |
] ifFalse:[ |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5406 |
x := x + rawLabelExtent x. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5407 |
y := y + rawLabelExtent y. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5408 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5409 |
isButton ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5410 |
menuPanel showSeparatingLines ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5411 |
"width of separator is 2 plus right offset 1 := 3" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5412 |
isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5413 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5414 |
(indication notNil or:[choice notNil]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5415 |
x := x + 2 + menuPanel iconIndicationOff width. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5416 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5417 |
] |
1699 | 5418 |
]. |
5419 |
^ x@y |
|
388 | 5420 |
! ! |
5421 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5422 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 5423 |
|
5424 |
activeHelpKey |
|
5425 |
"get the active helpKey; the key to retrieve the helpText from the application |
|
5426 |
" |
|
5427 |
^ activeHelpKey |
|
5428 |
! |
|
5429 |
||
5430 |
activeHelpKey:aHelpKey |
|
5431 |
"set the active helpKey; the key to retrieve the helpText from the application |
|
5432 |
" |
|
5433 |
activeHelpKey ~~ aHelpKey ifTrue:[ |
|
5434 |
activeHelpKey := aHelpKey. |
|
5435 |
activeHelpText := nil. |
|
5436 |
]. |
|
5437 |
||
5438 |
! |
|
5439 |
||
5440 |
activeHelpText |
|
5441 |
"get the active helpText or nil if not yet resolved |
|
5442 |
" |
|
5443 |
^ activeHelpText |
|
5444 |
! |
|
5445 |
||
5446 |
activeHelpText:aText |
|
5447 |
"set the active helpText |
|
5448 |
" |
|
5449 |
activeHelpText := aText. |
|
5450 |
! ! |
|
5451 |
||
1705 | 5452 |
!MenuPanel::Item methodsFor:'activation / deactivation'! |
5453 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5454 |
currentSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5455 |
"returns the current submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5456 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5457 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5458 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5459 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5460 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5461 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5462 |
|
1705 | 5463 |
hideSubmenu |
5464 |
"hide submenu |
|
5465 |
" |
|
5466 |
|id| |
|
5467 |
||
5468 |
subMenu notNil ifTrue:[ |
|
5469 |
subMenu realized ifFalse:[ |
|
5470 |
(id := subMenu id) notNil ifTrue:[ |
|
5471 |
menuPanel device unmapWindow:id |
|
5472 |
] |
|
5473 |
] ifTrue:[ |
|
5474 |
subMenu hide |
|
5475 |
]. |
|
5476 |
||
5477 |
subMenu windowGroup:nil. |
|
5478 |
menuPanel windowGroup removeView:subMenu. |
|
5479 |
||
5480 |
"/ release menu if derived from channel |
|
5481 |
submenuChannel notNil ifTrue:[ |
|
5482 |
subMenu := nil |
|
5483 |
] |
|
5484 |
]. |
|
5485 |
! |
|
1701 | 5486 |
|
5487 |
openSubmenu |
|
5488 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
5489 |
is fully visible by shifting it into the visible screen area if |
|
5490 |
nescessary. |
|
5491 |
" |
|
1790
98b89f8f4c17
do not select the first item if it represants a submenu
ca
parents:
1788
diff
changeset
|
5492 |
|p o device isVertical topMenu windGrp prefExtent item |
1701 | 5493 |
devBot "{ Class:SmallInteger }" |
5494 |
devRight "{ Class:SmallInteger }" |
|
5495 |
width "{ Class:SmallInteger }" |
|
5496 |
height "{ Class:SmallInteger }" |
|
5497 |
top "{ Class:SmallInteger }" |
|
5498 |
left "{ Class:SmallInteger }" |
|
5499 |
| |
|
5500 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
5501 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
1701 | 5502 |
^ self |
5503 |
]. |
|
5504 |
||
5505 |
topMenu := menuPanel topMenu. |
|
1829 | 5506 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
5507 |
subMenu releaseDeviceResources. |
|
5508 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
5509 |
subMenu recreate. |
|
5510 |
]. |
|
5511 |
||
1701 | 5512 |
windGrp := topMenu windowGroup. |
5513 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5514 |
subMenu superMenu:menuPanel. |
1701 | 5515 |
subMenu becomesActiveMenu. |
5516 |
subMenu cursor:Cursor hand. |
|
5517 |
||
5518 |
windGrp notNil ifTrue:[ |
|
5519 |
subMenu windowGroup:windGrp. |
|
5520 |
windGrp addTopView:subMenu. |
|
5521 |
]. |
|
5522 |
||
5523 |
" Q&D kludge - if any visibility attributes are blocks; |
|
5524 |
TODO: only invoke mustRearrange if any are blocks |
|
5525 |
(since I react correctly on valueHolder changes) |
|
5526 |
" |
|
5527 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
5528 |
subMenu fixSize. |
|
5529 |
||
5530 |
"compute origin of subMenu |
|
5531 |
" |
|
5532 |
isVertical := menuPanel verticalLayout. |
|
5533 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5534 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5535 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5536 |
width := prefExtent x. |
1701 | 5537 |
devBot := device usableHeight. |
5538 |
devRight := device usableWidth. |
|
5539 |
||
5540 |
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
|
5541 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5542 |
menuPanel isPopUpView ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5543 |
o := menuPanel origin + p |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5544 |
] ifFalse:[ |
1791 | 5545 |
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
|
5546 |
]. |
1701 | 5547 |
left := o x. |
5548 |
top := o y. |
|
5549 |
||
2016 | 5550 |
top + height > devBot ifTrue:[ |
5551 |
top := isVertical ifTrue:[devBot - height] |
|
5552 |
ifFalse:[top - layout height - height + 2] |
|
5553 |
]. |
|
5554 |
top := top max:0. |
|
5555 |
||
5556 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
5557 |
"/ top < menuPanel bottom ifTrue:[ |
|
5558 |
"/ left := left + layout width. |
|
5559 |
"/ ]. |
|
5560 |
"/ left + width > devRight ifTrue:[ |
|
5561 |
"/ left := o x - width - 2 |
|
5562 |
"/ ]. |
|
5563 |
"/ ]. |
|
5564 |
||
1701 | 5565 |
left + width > devRight ifTrue:[ |
2012 | 5566 |
left := isVertical ifTrue:[left - layout width - width + 2] |
1701 | 5567 |
ifFalse:[devRight - width] |
5568 |
]. |
|
5569 |
left := left max:0. |
|
5570 |
||
5571 |
subMenu origin:(left@top). |
|
5572 |
||
5573 |
subMenu realized ifFalse:[ |
|
5574 |
subMenu realize. |
|
5575 |
] ifTrue:[ |
|
5576 |
topMenu device mapWindow:(subMenu id). |
|
5577 |
]. |
|
1790
98b89f8f4c17
do not select the first item if it represants a submenu
ca
parents:
1788
diff
changeset
|
5578 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5579 |
menuPanel openMenuOnSelect ifFalse:[ |
1791 | 5580 |
( menuPanel superMenu notNil "/ not the top menu |
5581 |
or:[((item := subMenu itemAt:1) notNil and:[item hasSubmenu not])] "/ top menu but no submenu item |
|
1790
98b89f8f4c17
do not select the first item if it represants a submenu
ca
parents:
1788
diff
changeset
|
5582 |
) ifTrue:[ |
98b89f8f4c17
do not select the first item if it represants a submenu
ca
parents:
1788
diff
changeset
|
5583 |
subMenu selectionIndex:1 |
98b89f8f4c17
do not select the first item if it represants a submenu
ca
parents:
1788
diff
changeset
|
5584 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5585 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5586 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5587 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5588 |
toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5589 |
"toggle the visibility of the submenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5590 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5591 |
subMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5592 |
subMenu shown ifTrue:[^ self hideSubmenu] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5593 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5594 |
(subMenu := self setupSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5595 |
"/ cannot open a submenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5596 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5597 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5598 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5599 |
self openSubmenu. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5600 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5601 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5602 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5603 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5604 |
visibleSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5605 |
"returns the current visible submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5606 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5607 |
subMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5608 |
subMenu shown ifTrue:[^ subMenu]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5609 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5610 |
^ nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5611 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5612 |
|
1701 | 5613 |
|
5614 |
! ! |
|
5615 |
||
524 | 5616 |
!MenuPanel::Item methodsFor:'building'! |
5617 |
||
5618 |
aspectAt:aKey |
|
5619 |
"retursns value assigned to key or nil |
|
5620 |
" |
|
5621 |
|appl value| |
|
5622 |
||
5623 |
appl := menuPanel receiver. |
|
5624 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
5625 |
(appl isValueModel) ifTrue:[ |
1775 | 5626 |
^ appl value:aKey |
524 | 5627 |
]. |
5628 |
||
5629 |
(appl notNil or:[(appl := menuPanel application) notNil]) ifTrue:[ |
|
1775 | 5630 |
Object messageNotUnderstoodSignal handle:[:ex| |
5631 |
ex parameter selector == aKey ifFalse:[ |
|
5632 |
ex reject |
|
5633 |
]. |
|
2059 | 5634 |
('MenuPanel [info]: application does not provide aspect: ' , aKey) infoPrintCR. |
1775 | 5635 |
] do:[ |
5636 |
aKey last == $: ifTrue:[ |
|
5637 |
value := appl perform:aKey with:(argument ? self). |
|
5638 |
] ifFalse:[ |
|
2059 | 5639 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
1775 | 5640 |
value := appl aspectFor:aKey |
5641 |
] ifFalse:[ |
|
5642 |
value := appl perform:aKey |
|
5643 |
] |
|
5644 |
] |
|
5645 |
] |
|
524 | 5646 |
]. |
5647 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
5648 |
|
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
5649 |
"Modified: / 29.7.1998 / 11:59:50 / cg" |
524 | 5650 |
! ! |
5651 |
||
390 | 5652 |
!MenuPanel::Item methodsFor:'change & update'! |
5653 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5654 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5655 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5656 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5657 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5658 |
(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
|
5659 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5660 |
self isSeparator ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5661 |
"/ NOT A SEPARATOR |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5662 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5663 |
menuPanel shown ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5664 |
changedObject == enableChannel ifTrue:[ |
1864
cbc44ec70112
clear selection if item changed to disabled durring selected
ca
parents:
1862
diff
changeset
|
5665 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
cbc44ec70112
clear selection if item changed to disabled durring selected
ca
parents:
1862
diff
changeset
|
5666 |
^ menuPanel selection:nil. |
cbc44ec70112
clear selection if item changed to disabled durring selected
ca
parents:
1862
diff
changeset
|
5667 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5668 |
^ self invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5669 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5670 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5671 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5672 |
isButton ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5673 |
self invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5674 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5675 |
"/ invalidate the interactor only |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5676 |
"/ take any interactor; interactors has the same extent |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5677 |
form := menuPanel iconIndicationOff. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5678 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5679 |
rect := Rectangle left:(layout left + HorizontalInset) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5680 |
top:(layout top) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5681 |
width:(form width) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5682 |
height:(layout height). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5683 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5684 |
menuPanel invalidate:rect repairNow:false |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5685 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5686 |
^ self |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5687 |
]. |
1692 | 5688 |
]. |
498 | 5689 |
]. |
712 | 5690 |
|
5691 |
changedObject == isVisible ifTrue:[ |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5692 |
menuPanel mustRearrange. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5693 |
menuPanel rearrangeItems. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5694 |
^ self. |
712 | 5695 |
]. |
5696 |
||
498 | 5697 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5698 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5699 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5700 |
updateIndicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5701 |
"update indicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5702 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5703 |
(indication notNil and:[indication isSymbol]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5704 |
" indication is a selector otherwise a change notification |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5705 |
is raised from the model !!!! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5706 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5707 |
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
|
5708 |
] |
390 | 5709 |
! ! |
5710 |
||
388 | 5711 |
!MenuPanel::Item methodsFor:'converting'! |
5712 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5713 |
asMenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5714 |
"convert to a MenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5715 |
" |
466 | 5716 |
|item label rcv| |
5717 |
||
5718 |
label := self label. |
|
5719 |
item := MenuItem labeled:(label printString). |
|
5720 |
||
5721 |
label isImage ifTrue:[ |
|
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
5722 |
rcv := ResourceRetriever new. |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
5723 |
rcv className:#MenuEditor. |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
5724 |
rcv selector:#iconUnknown. |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
5725 |
item labelImage:rcv. |
464 | 5726 |
]. |
466 | 5727 |
|
434 | 5728 |
item activeHelpKey:activeHelpKey. |
460 | 5729 |
|
1819 | 5730 |
enableChannel isSymbol ifTrue:[ |
5731 |
item enabled:enableChannel |
|
460 | 5732 |
]. |
1727 | 5733 |
item font:font. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5734 |
item accessCharacterPosition:accessCharacterPosition. |
1819 | 5735 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5736 |
item startGroup:startGroup. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5737 |
item argument:argument. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5738 |
item nameKey:nameKey. |
1609 | 5739 |
item shortcutKeyCharacter:shortcutKey. |
1819 | 5740 |
value isSymbol ifTrue:[item value:value]. |
5741 |
indication isSymbol ifTrue:[item indication:indication]. |
|
5742 |
choice isSymbol ifTrue:[item choice:choice]. |
|
5743 |
isVisible isSymbol ifTrue:[item isVisible:isVisible]. |
|
5744 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5745 |
item choiceValue:choiceValue. |
1819 | 5746 |
item hideMenuOnActivated:hideMenuOnActivated. |
5747 |
item keepLinkedMenu:keepLinkedMenu. |
|
5748 |
item showBusyCursorWhilePerforming:showBusyCursorWhilePerforming. |
|
1841 | 5749 |
item triggerOnDown:(self triggerOnDown). |
1045 | 5750 |
item isButton:isButton. |
388 | 5751 |
|
464 | 5752 |
submenuChannel isSymbol ifTrue:[ |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
5753 |
item submenuChannel:submenuChannel |
464 | 5754 |
] ifFalse:[ |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
5755 |
subMenu notNil ifTrue:[ |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
5756 |
item submenu:(subMenu asMenu) |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
5757 |
] |
388 | 5758 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5759 |
^ item |
388 | 5760 |
! |
5761 |
||
5762 |
menuItem:aMenuItem |
|
5763 |
"setup attributes from a MenuItem |
|
5764 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5765 |
|lbl| |
389 | 5766 |
|
388 | 5767 |
menuPanel disabledRedrawDo:[ |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5768 |
label := rawLabel := nil. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5769 |
accessCharacterPosition := aMenuItem accessCharacterPosition. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5770 |
argument := aMenuItem argument. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5771 |
choiceValue := aMenuItem choiceValue. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5772 |
showBusyCursorWhilePerforming := aMenuItem showBusyCursorWhilePerforming. |
1841 | 5773 |
triggerOnDown := aMenuItem triggerOnDown. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5774 |
hideMenuOnActivated := aMenuItem hideMenuOnActivated. |
1767 | 5775 |
keepLinkedMenu := aMenuItem keepLinkedMenu. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5776 |
isButton := aMenuItem isButton ? false. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5777 |
nameKey := aMenuItem nameKey. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5778 |
startGroup := aMenuItem startGroup. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5779 |
shortcutKey := aMenuItem shortcutKeyCharacter. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5780 |
value := aMenuItem value. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5781 |
activeHelpKey := aMenuItem activeHelpKey. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5782 |
activeHelpText := nil. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5783 |
|
1727 | 5784 |
self font:(aMenuItem font). |
5785 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5786 |
self enabled:(aMenuItem enabled). |
1572 | 5787 |
self indication:(aMenuItem indication). |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5788 |
self choice:(aMenuItem choice). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5789 |
self isVisible:(aMenuItem isVisible). |
1572 | 5790 |
|
5791 |
(lbl := aMenuItem labelImage value) isNil ifTrue:[ |
|
5792 |
lbl := aMenuItem rawLabel. "/ avoid translating &'s twice |
|
5793 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5794 |
|
1572 | 5795 |
self label:lbl. |
5796 |
submenuChannel := aMenuItem submenuChannel. |
|
5797 |
self submenu:(aMenuItem submenu). |
|
388 | 5798 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
5799 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
5800 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 5801 |
! ! |
5802 |
||
5803 |
!MenuPanel::Item methodsFor:'drawing'! |
|
5804 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5805 |
drawButton |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5806 |
"draw as button |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5807 |
" |
2059 | 5808 |
|drawObject fg etchFg level isEnabled isSelected bg ownBgCol |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5809 |
x "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5810 |
| |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5811 |
drawObject := rawLabel. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5812 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5813 |
"COMPUTE COLORS" |
2059 | 5814 |
isEnabled := self enabled. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5815 |
(isSelected := self isSelected) ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5816 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5817 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5818 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5819 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5820 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5821 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5822 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5823 |
]. |
2059 | 5824 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5825 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5826 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5827 |
fg := menuPanel disabledForegroundColor. |
2059 | 5828 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5829 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5830 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5831 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5832 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
5833 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
5834 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
5835 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
5836 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5837 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5838 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5839 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5840 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5841 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5842 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5843 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5844 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5845 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5846 |
"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
|
5847 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5848 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5849 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5850 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5851 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5852 |
isSelected := (choice notNil and:[choice value = choiceValue]). |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5853 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5854 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5855 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5856 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5857 |
level := menuPanel buttonActiveLevel. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5858 |
x := x + level abs. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5859 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5860 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2059 | 5861 |
ifFalse:[menuPanel buttonPassiveLevel]. |
5862 |
]. |
|
5863 |
||
5864 |
etchFg notNil ifTrue:[ |
|
5865 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
5866 |
]. |
|
5867 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5868 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5869 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5870 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5871 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5872 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5873 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5874 |
drawLabel |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5875 |
"draw a labeled entry; no button, no separator. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5876 |
" |
2059 | 5877 |
|scKey cLb cLa drawObject fg etchFg arrow |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
5878 |
isSelected isEnabled form |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5879 |
h "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5880 |
y "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5881 |
x "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5882 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5883 |
| |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5884 |
drawObject := rawLabel. |
1048 | 5885 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
5886 |
isEnabled := self enabled. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
5887 |
isSelected := self isSelected. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
5888 |
isSelected ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5889 |
fg := self activeForegroundColor |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5890 |
] ifFalse:[ |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
5891 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5892 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5893 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5894 |
fg := menuPanel disabledForegroundColor. |
2059 | 5895 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5896 |
drawObject := self disabledRawLabel |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5897 |
] |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5898 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5899 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5900 |
h := layout height. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5901 |
x := layout left + HorizontalInset. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5902 |
t := layout top. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5903 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5904 |
((form := self indicatorForm) notNil or:[(form := self choiceForm) notNil]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5905 |
y := t + ((h - form height) // 2). |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
5906 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5907 |
form displayOn:menuPanel x:x y:y. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5908 |
x := x + 2 + form width. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5909 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5910 |
|
2059 | 5911 |
etchFg notNil ifTrue:[ |
5912 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
5913 |
]. |
|
5914 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
1046 | 5915 |
|
608 | 5916 |
"/ DRAW SHORTCUT KEY |
5917 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5918 |
( shortcutKey notNil |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5919 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5920 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5921 |
) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5922 |
x := layout left + x. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5923 |
y := t + ((h - (scKey heightOn:menuPanel)) // 2). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5924 |
y := y + menuPanel font ascent. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5925 |
scKey displayOn:menuPanel x:x y:y. |
608 | 5926 |
]. |
963
2660033bc16e
hide shortKeys in menu (may be later enabled via a classVar)
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
5927 |
|
608 | 5928 |
"/ DRAW SUBMENU INDICATION |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5929 |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5930 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5931 |
arrow := menuPanel rightArrow. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5932 |
x := layout right - arrow width - HorizontalInset. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5933 |
y := t + (h - arrow height // 2). |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5934 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5935 |
(menuPanel styleSheet is3D not |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5936 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5937 |
^ menuPanel displayForm:arrow x:x y:y |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5938 |
]. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5939 |
cLa := menuPanel shadowColor. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5940 |
cLb := menuPanel lightColor. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5941 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5942 |
isSelected ifFalse:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5943 |
fg := cLa. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5944 |
cLa := cLb. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5945 |
cLb := fg |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5946 |
]. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5947 |
menuPanel paint:cLa. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5948 |
menuPanel displayForm:arrow x:x y:y. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
5949 |
menuPanel paint:cLb. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5950 |
menuPanel displayForm:drawObject x:x y:y. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5951 |
] |
746 | 5952 |
|
1124 | 5953 |
"Modified: / 6.9.1998 / 21:48:53 / cg" |
388 | 5954 |
! |
5955 |
||
2059 | 5956 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5957 |
"draw a labeled entry; no button, no separator. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5958 |
" |
2059 | 5959 |
|mfont fontAscent |
1727 | 5960 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5961 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5962 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5963 |
| |
2059 | 5964 |
|
1727 | 5965 |
mfont := menuPanel setFont:font. |
2059 | 5966 |
fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5967 |
menuPanel paint:fg. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5968 |
|
2059 | 5969 |
y := layout top + (layout height - rawLabelExtent y // 2) + yOffset. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5970 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5971 |
aLabel isArray ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5972 |
aLabel isImageOrForm ifFalse:[ |
2059 | 5973 |
y := y + fontAscent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5974 |
]. |
1727 | 5975 |
aLabel displayOn:menuPanel x:x y:y. |
5976 |
] ifTrue:[ |
|
5977 |
aLabel do:[:el| |
|
5978 |
el notNil ifTrue:[ |
|
5979 |
el isImageOrForm ifFalse:[ |
|
2059 | 5980 |
y0 := y + fontAscent |
1727 | 5981 |
] ifTrue:[ |
5982 |
y0 := y |
|
5983 |
]. |
|
5984 |
x0 := x + (rawLabelExtent x - (el widthOn:menuPanel) // 2). |
|
5985 |
el displayOn:menuPanel x:x0 y:y0. |
|
5986 |
y := y + 1 + (el heightOn:menuPanel) |
|
5987 |
] ifFalse:[ |
|
5988 |
y := y + 3 "/ see #label: |
|
5989 |
] |
|
5990 |
]. |
|
5991 |
]. |
|
5992 |
menuPanel setFont:mfont |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5993 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5994 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5995 |
drawSeparatingLines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5996 |
"draw separating lines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5997 |
" |
2059 | 5998 |
|myIndex lfSep rtSep items prevItem nextItem |
5999 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6000 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6001 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6002 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6003 |
b "{ Class:SmallInteger }" |
706 | 6004 |
| |
2059 | 6005 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6006 |
items := menuPanel items. |
2059 | 6007 |
myIndex := items identityIndexOf:self. |
6008 |
||
6009 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
6010 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
6011 |
||
6012 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
6013 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
6014 |
||
6015 |
(lfSep or:[rtSep]) ifFalse:[ |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6016 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6017 |
]. |
2059 | 6018 |
|
6019 |
lightColor := menuPanel lightColor. |
|
6020 |
shadowColor := menuPanel shadowColor. |
|
6021 |
||
6022 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6023 |
|
608 | 6024 |
l := layout left. |
6025 |
t := layout top. |
|
6026 |
r := layout right. |
|
6027 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6028 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6029 |
menuPanel verticalLayout ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6030 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6031 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6032 |
|
2059 | 6033 |
menuPanel paint:shadowColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6034 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6035 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-2 toX:r y:b-2]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6036 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6037 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6038 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6039 |
|
2059 | 6040 |
menuPanel paint:shadowColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6041 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6042 |
rtSep ifTrue:[menuPanel displayLineFromX:r-2 y:t toX:r-2 y:b]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6043 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6044 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6045 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6046 |
drawSeparator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6047 |
"draw as separator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6048 |
" |
2059 | 6049 |
|type lightColor shadowColor isDouble |
6050 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6051 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6052 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6053 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6054 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6055 |
| |
2059 | 6056 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6057 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6058 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6059 |
^ self |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6060 |
]. |
2059 | 6061 |
|
6062 |
isDouble := type == #doubleLine. |
|
6063 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6064 |
lightColor := menuPanel lightColor. |
2059 | 6065 |
shadowColor := menuPanel shadowColor. |
6066 |
menuPanel paint:shadowColor. |
|
6067 |
||
6068 |
left := layout left. |
|
6069 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6070 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6071 |
menuPanel verticalLayout ifTrue:[ |
2059 | 6072 |
x0 := left + HorizontalInset. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6073 |
x1 := layout right - HorizontalInset. |
2059 | 6074 |
y0 := top - 1 + (layout height // 2). |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6075 |
isDouble ifTrue:[y0 := y0 - 2]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6076 |
|
2059 | 6077 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6078 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6079 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6080 |
menuPanel paint:lightColor. |
2059 | 6081 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6082 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+5 toX:x1 y:y0+5]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6083 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6084 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6085 |
y1 := layout bottom. |
2059 | 6086 |
x0 := left - 1 + (layout width // 2). |
6087 |
y0 := top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6088 |
isDouble ifTrue:[x0 := x0 - 2]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6089 |
|
2059 | 6090 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6091 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6092 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6093 |
menuPanel paint:lightColor. |
2059 | 6094 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6095 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+5 y:y0 toX:x0+5 y:y1]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6096 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6097 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6098 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6099 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6100 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6101 |
(rawLabel notNil and:[menuPanel notNil]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6102 |
menuPanel invalidateItem:self repairNow:false |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6103 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6104 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6105 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6106 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6107 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6108 |
redraw |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6109 |
"redraw item |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6110 |
" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6111 |
|isSelected ownBgCol paint bgColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6112 |
x "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6113 |
y "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6114 |
w "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6115 |
h "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6116 |
| |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6117 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6118 |
self isVisible ifFalse:[^ self]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6119 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6120 |
rawLabel isNil ifTrue:[^ self drawSeparator]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6121 |
isButton ifTrue:[^ self drawButton]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6122 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6123 |
"/ DRAW A LABELED ENTRY; no button, no separator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6124 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6125 |
isSelected := self isSelected. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6126 |
bgColor := menuPanel backgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6127 |
paint := isSelected ifTrue:[self activeBackgroundColor] ifFalse:[bgColor]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6128 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6129 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6130 |
paint := ownBgCol |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6131 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6132 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6133 |
paint ~= bgColor ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6134 |
menuPanel paint:paint. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6135 |
menuPanel fillRectangle:layout. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6136 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6137 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6138 |
menuPanel showSeparatingLines ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6139 |
self drawSeparatingLines |
608 | 6140 |
]. |
6141 |
||
650 | 6142 |
self drawLabel. |
6143 |
||
1045 | 6144 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6145 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6146 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6147 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6148 |
x := layout left. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6149 |
y := layout top. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6150 |
w := layout width. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6151 |
h := layout height. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6152 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6153 |
menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2). |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6154 |
menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4). |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6155 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6156 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6157 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6158 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6159 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6160 |
|
388 | 6161 |
! ! |
6162 |
||
6163 |
!MenuPanel::Item methodsFor:'initialization'! |
|
6164 |
||
6165 |
destroy |
|
616 | 6166 |
"destroy submenus, remove dependencies |
388 | 6167 |
" |
616 | 6168 |
self submenu:nil. |
6169 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6170 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6171 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6172 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6173 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
616 | 6174 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6175 |
menuPanel := nil. |
616 | 6176 |
! |
6177 |
||
794 | 6178 |
in:aPanel |
6179 |
"create item in a menuPanel |
|
6180 |
" |
|
6181 |
menuPanel := aPanel. |
|
1045 | 6182 |
isButton := false. |
1811 | 6183 |
! |
6184 |
||
6185 |
reinitStyle |
|
6186 |
||
6187 |
subMenu notNil ifTrue:[ |
|
6188 |
subMenu reinitStyle |
|
6189 |
]. |
|
6190 |
||
6191 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
6192 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 6193 |
! ! |
6194 |
||
6195 |
!MenuPanel::Item methodsFor:'label basics'! |
|
6196 |
||
6197 |
disabledRawLabel |
|
6198 |
"returns the label used if the item is disabled |
|
6199 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6200 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6201 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6202 |
disabledRawLabel notNil ifTrue:[^ disabledRawLabel]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6203 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6204 |
disabledRawLabel := rawLabel ? ''. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6205 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6206 |
disabledRawLabel isString ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6207 |
^ disabledRawLabel |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6208 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6209 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6210 |
block := [:el| |rslt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6211 |
(rslt := el) notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6212 |
el isImageOrForm ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6213 |
el colorMap notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6214 |
rslt := menuPanel lightenedImageOnDevice:el |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6215 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6216 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6217 |
el class == LabelAndIcon ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6218 |
((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6219 |
form := menuPanel lightenedImageOnDevice:form |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6220 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6221 |
((image := el image) notNil and:[image colorMap notNil]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6222 |
image := menuPanel lightenedImageOnDevice:image |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6223 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6224 |
rslt := LabelAndIcon form:form image:image string:(el string). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6225 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6226 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6227 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6228 |
rslt |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6229 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6230 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6231 |
rawLabel isArray ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6232 |
disabledRawLabel := Array new:(rawLabel size). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6233 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6234 |
rawLabel keysAndValuesDo:[:anIndex :aLabel| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6235 |
disabledRawLabel at:anIndex put:(block value:aLabel) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6236 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6237 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6238 |
disabledRawLabel := block value:rawLabel |
794 | 6239 |
]. |
6240 |
^ disabledRawLabel |
|
6241 |
! |
|
6242 |
||
1829 | 6243 |
fetchDeviceResources |
6244 |
disabledRawLabel := nil. |
|
6245 |
self fetchImages. |
|
6246 |
||
6247 |
font notNil ifTrue:[ |
|
6248 |
font := font onDevice:(menuPanel device) |
|
6249 |
]. |
|
6250 |
! |
|
6251 |
||
616 | 6252 |
fetchImages |
6253 |
"fetch images |
|
6254 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6255 |
|icon block| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6256 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6257 |
rawLabel notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6258 |
block := [:el| |rslt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6259 |
(rslt := el) notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6260 |
el isImageOrForm ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6261 |
rslt := menuPanel imageOnDevice:el |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6262 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6263 |
el class == LabelAndIcon ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6264 |
(icon := el image) notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6265 |
el image:(menuPanel imageOnDevice:icon) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6266 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6267 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6268 |
(icon := el icon) notNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6269 |
el icon:(menuPanel imageOnDevice:icon) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6270 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6271 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6272 |
] |
1709 | 6273 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6274 |
rslt |
1709 | 6275 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6276 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6277 |
rawLabel isArray ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6278 |
rawLabel keysAndValuesDo:[:anIndex :aLabel| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6279 |
rawLabel at:anIndex put:(block value:aLabel) |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6280 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6281 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6282 |
rawLabel := block value:rawLabel |
1709 | 6283 |
] |
1078 | 6284 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6285 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6286 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6287 |
updateAccessCharacterFor:aLabel |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6288 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6289 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6290 |
(accessCharacter notNil or:[aLabel isNil]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6291 |
^ aLabel |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6292 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6293 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6294 |
aLabel isString ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6295 |
aLabel class == LabelAndIcon ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6296 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
1709 | 6297 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6298 |
^ aLabel |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6299 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6300 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6301 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6302 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6303 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6304 |
label := aLabel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6305 |
pos := accessCharacterPosition. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6306 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6307 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6308 |
rest := label copyFrom:(i+1). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6309 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6310 |
i == 1 ifTrue:[label := rest] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6311 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6312 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6313 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6314 |
s := s - 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6315 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6316 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6317 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
1762 | 6318 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6319 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6320 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6321 |
label isText ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6322 |
label := Text string:label |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6323 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6324 |
label emphasisAt:pos add:#underline. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6325 |
^ label |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6326 |
|
388 | 6327 |
! ! |
6328 |
||
1573 | 6329 |
!MenuPanel::Item methodsFor:'printing & storing'! |
6330 |
||
6331 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6332 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6333 |
|
1573 | 6334 |
! ! |
6335 |
||
388 | 6336 |
!MenuPanel::Item methodsFor:'private'! |
6337 |
||
650 | 6338 |
activeBackgroundColor |
6339 |
"returns the active background color derived from menuPanel |
|
6340 |
" |
|
6341 |
||
1045 | 6342 |
isButton ifTrue: [^menuPanel buttonActiveBackgroundColor]. |
650 | 6343 |
^menuPanel activeBackgroundColor |
6344 |
! |
|
6345 |
||
6346 |
activeForegroundColor |
|
6347 |
"returns the active foreground color derived from menuPanel |
|
6348 |
" |
|
6349 |
||
6350 |
^menuPanel activeForegroundColor |
|
6351 |
! |
|
6352 |
||
727 | 6353 |
backgroundColor |
6354 |
"returns the background color derived from menuPanel |
|
6355 |
" |
|
6356 |
||
1045 | 6357 |
isButton ifTrue: [^menuPanel buttonPassiveBackgroundColor]. |
727 | 6358 |
^menuPanel backgroundColor |
6359 |
! |
|
6360 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6361 |
backgroundColorFromLabel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6362 |
"returns the background color derived from label or nil |
388 | 6363 |
" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6364 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6365 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6366 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6367 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6368 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6369 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6370 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6371 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6372 |
run size == 0 ifTrue:[ |
1117 | 6373 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
6374 |
^ run value |
|
6375 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6376 |
] ifFalse:[ |
1117 | 6377 |
run do:[:r| |
6378 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
6379 |
^ r value |
|
6380 |
] |
|
6381 |
] |
|
388 | 6382 |
]. |
6383 |
^ nil |
|
6384 |
! |
|
6385 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6386 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6387 |
"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
|
6388 |
derived from menuPanel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6389 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6390 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6391 |
isButton ifTrue: [^ menuPanel buttonEnteredBackgroundColor]. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6392 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6393 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6394 |
"Created: / 20.8.1998 / 13:56:10 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6395 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6396 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6397 |
choiceForm |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6398 |
"returns choice form or nil |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6399 |
" |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6400 |
|isOn| |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6401 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6402 |
choice isNil ifTrue:[^ nil]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6403 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6404 |
isOn := choice value = choiceValue. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6405 |
self enabled ifFalse:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6406 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6407 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6408 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6409 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6410 |
ifFalse:[menuPanel iconRadioGroupOff] |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6411 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6412 |
|
663 | 6413 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6414 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6415 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6416 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6417 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6418 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6419 |
|subm sel num| |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6420 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6421 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6422 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6423 |
sel := submenuChannel asSymbol. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6424 |
num := sel numArgs. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6425 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6426 |
num == 0 ifTrue:[ |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6427 |
Object messageNotUnderstoodSignal handle:[:ex| |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6428 |
|selector| |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6429 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6430 |
((selector := ex parameter selector) == sel |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6431 |
or:[selector == #aspectFor:]) ifFalse:[ |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6432 |
ex reject |
1705 | 6433 |
]. |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6434 |
] do:[ |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6435 |
subm := aRecv aspectFor:sel. |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6436 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6437 |
subm notNil ifTrue:[^ subm]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6438 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6439 |
|
2043 | 6440 |
(Array with:(aRecv) with:(aRecv class)) |
6441 |
do:[:aPossibleReceiver | |
|
6442 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
6443 |
ex parameter selector == sel ifFalse:[ ex reject ] |
|
6444 |
] do:[ |
|
6445 |
num == 0 ifTrue:[subm := aPossibleReceiver perform:sel] |
|
6446 |
ifFalse:[num == 1 ifTrue:[subm := aPossibleReceiver perform:sel with:(argument ? menuPanel)] |
|
6447 |
ifFalse:[ subm := aPossibleReceiver perform:sel with:argument with:menuPanel]] |
|
6448 |
]. |
|
6449 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6450 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6451 |
|
663 | 6452 |
^ subm |
2043 | 6453 |
|
6454 |
"Modified: / 30.10.2001 / 13:28:25 / cg" |
|
663 | 6455 |
! |
6456 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6457 |
indicationValue |
524 | 6458 |
"returns indication value or nil in case of no indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6459 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6460 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6461 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6462 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6463 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6464 |
indication isSymbol ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6465 |
^ indication value == true "block or model" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6466 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6467 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6468 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6469 |
recv := menuPanel receiver. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6470 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6471 |
(recv isValueModel) ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6472 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6473 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6474 |
sel := sel asSymbol. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6475 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6476 |
Object messageNotUnderstoodSignal handle:[:ex| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6477 |
ex parameter selector == sel ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6478 |
ex reject |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6479 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6480 |
] do:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6481 |
sel := recv perform:sel with:argument |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6482 |
] |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6483 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6484 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6485 |
^ sel value == true |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6486 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6487 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6488 |
numArgs ~~ 0 ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6489 |
sel := (indication copyWithoutLast:1) asSymbol |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6490 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6491 |
sel := indication |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6492 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6493 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6494 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6495 |
sel isValueModel ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6496 |
indication := sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6497 |
indication addDependent:self. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6498 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6499 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6500 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6501 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6502 |
indicationValue:aValue |
1218 | 6503 |
"set the indication value |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6504 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6505 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6506 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6507 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6508 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6509 |
indication isSymbol ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6510 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6511 |
^ self |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6512 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6513 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6514 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6515 |
^ self |
1218 | 6516 |
]. |
6517 |
||
524 | 6518 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6519 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6520 |
|
1218 | 6521 |
recv isNil ifTrue:[ |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6522 |
recv := menuPanel application. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6523 |
recv isNil ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6524 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6525 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6526 |
Object messageNotUnderstoodSignal handle:[:ex| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6527 |
(ex parameter selector ~~ indication) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6528 |
ex reject |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6529 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6530 |
('MenuPanel [info]: application does not respond to ' , indication) infoPrintCR. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6531 |
] do:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6532 |
numArgs == 1 ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6533 |
recv perform:indication with:aValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6534 |
] ifFalse:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6535 |
recv perform:indication with:(argument ? self) with:aValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6536 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6537 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6538 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6539 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6540 |
indicatorForm |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6541 |
"returns indication form or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6542 |
" |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6543 |
|val| |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6544 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6545 |
indication isNil ifTrue:[^ nil]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6546 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6547 |
val := self indicationValue. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6548 |
self enabled ifFalse:[ |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6549 |
^ val == true |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6550 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6551 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6552 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6553 |
^ val == true |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6554 |
ifTrue:[menuPanel iconIndicationOn] |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6555 |
ifFalse:[menuPanel iconIndicationOff] |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6556 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6557 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6558 |
isEntered |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6559 |
"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
|
6560 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6561 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6562 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6563 |
"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
|
6564 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6565 |
|
464 | 6566 |
separatorType |
6567 |
"returns type of separator line or nil |
|
388 | 6568 |
" |
390 | 6569 |
|c lbl| |
388 | 6570 |
|
6571 |
rawLabel isNil ifFalse:[ |
|
1117 | 6572 |
^ nil |
388 | 6573 |
]. |
6574 |
||
390 | 6575 |
(lbl := label value) isNil ifTrue:[ |
1117 | 6576 |
^ #singleLine |
388 | 6577 |
]. |
6578 |
||
390 | 6579 |
lbl size == 1 ifTrue:[ |
1117 | 6580 |
c := lbl first. |
6581 |
c == $- ifTrue:[^ #singleLine]. |
|
6582 |
c == $= ifTrue:[^ #doubleLine]. |
|
388 | 6583 |
]. |
6584 |
^ #blankLine |
|
1130 | 6585 |
! |
6586 |
||
6587 |
setupSubmenu |
|
6588 |
|appl recv subm| |
|
6589 |
||
6590 |
submenuChannel notNil ifTrue:[ |
|
1609 | 6591 |
submenuChannel isSymbol ifFalse:[ |
6592 |
subm := submenuChannel |
|
6593 |
] ifTrue:[ |
|
6594 |
appl := menuPanel application. |
|
6595 |
||
6596 |
(subm := self findSubMenuIn:appl) isNil ifTrue:[ |
|
6597 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
|
6598 |
subm := self findSubMenuIn:recv |
|
6599 |
] |
|
6600 |
] |
|
6601 |
]. |
|
6602 |
||
6603 |
(subm := subm value) isArray ifTrue:[ |
|
6604 |
subm := Menu new fromLiteralArrayEncoding:subm. |
|
6605 |
"/ cg: linked menus also may contain translations ... |
|
6606 |
subm notNil ifTrue:[ |
|
6607 |
appl notNil ifTrue:[ |
|
6608 |
subm findGuiResourcesIn:appl. |
|
6609 |
] |
|
6610 |
]. |
|
6611 |
]. |
|
6612 |
self submenu:subm. |
|
1130 | 6613 |
]. |
6614 |
||
6615 |
^ subMenu |
|
6616 |
||
6617 |
"Modified: / 19.5.1998 / 19:36:56 / cg" |
|
388 | 6618 |
! ! |
6619 |
||
6620 |
!MenuPanel::Item methodsFor:'queries'! |
|
6621 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
6622 |
canChangeVisibility |
1699 | 6623 |
"return true if I am not always visible; can only be changed by a selector |
6624 |
otherwise there is a change notification raised if the model changed |
|
6625 |
" |
|
6626 |
^ isVisible isSymbol |
|
6627 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
6628 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
6629 |
|
388 | 6630 |
canSelect |
1699 | 6631 |
"returns true if item is selectable; no separator, visible and enabled. |
6632 |
in case of a choice (RadioButton) i have to check for the choiceValue |
|
388 | 6633 |
" |
1699 | 6634 |
(rawLabel notNil and:[self isVisible and:[self enabled]]) ifTrue:[ |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6635 |
(choice isNil or:[choice value ~= choiceValue]) ifTrue:[ |
1699 | 6636 |
^ true |
6637 |
]. |
|
1078 | 6638 |
]. |
6639 |
^ false |
|
388 | 6640 |
! |
6641 |
||
2046 | 6642 |
containsPoint:aPoint |
6643 |
"returns true if aPoint is contained in my layout |
|
6644 |
" |
|
6645 |
(self isVisible and:[layout notNil]) ifTrue:[ |
|
6646 |
^ layout containsPoint:aPoint |
|
6647 |
]. |
|
6648 |
^ false |
|
6649 |
||
6650 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
6651 |
! |
|
6652 |
||
388 | 6653 |
containsPointX:x y:y |
6654 |
"returns true if point is contained in my layout |
|
6655 |
" |
|
712 | 6656 |
(self isVisible and:[layout notNil]) ifTrue:[ |
1699 | 6657 |
^ layout containsPointX:x y:y |
505 | 6658 |
]. |
6659 |
^ false |
|
388 | 6660 |
! |
6661 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6662 |
hasIndication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6663 |
"returns true if on/off indication exists |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6664 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6665 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6666 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6667 |
|
388 | 6668 |
hasSubmenu |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
6669 |
"returns true if the item is configured as an subMenu entry |
388 | 6670 |
" |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
6671 |
^ subMenu notNil or:[submenuChannel notNil] |
388 | 6672 |
! |
6673 |
||
6674 |
isEnabled |
|
6675 |
"returns enabled state |
|
6676 |
" |
|
6677 |
^ self enabled |
|
6678 |
! |
|
6679 |
||
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
6680 |
isLabeledItem |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
6681 |
"returns true if the item is no button and no separator |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
6682 |
" |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
6683 |
^ rawLabel notNil and:[isButton not] |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
6684 |
! |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
6685 |
|
608 | 6686 |
isSeparator |
6687 |
"returns true if item is a separator |
|
6688 |
" |
|
6689 |
^ rawLabel isNil |
|
6690 |
! |
|
6691 |
||
712 | 6692 |
isVisible |
6693 |
"returns the visibility state |
|
6694 |
" |
|
6695 |
|state| |
|
6696 |
||
6697 |
isVisible isSymbol ifTrue:[ |
|
1699 | 6698 |
state := self aspectAt:isVisible. |
6699 |
||
6700 |
state isValueModel ifTrue:[ |
|
6701 |
isVisible := state. |
|
6702 |
isVisible addDependent:self. |
|
6703 |
state := isVisible. |
|
6704 |
] |
|
712 | 6705 |
] ifFalse:[ |
1699 | 6706 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
6707 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
6708 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
6709 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
6710 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 6711 |
! |
6712 |
||
6713 |
isVisible:something |
|
6714 |
"change the state; if the state changed, a redraw is performed |
|
6715 |
" |
|
6716 |
|oldState newState| |
|
6717 |
||
6718 |
isVisible isNil ifTrue:[ |
|
1699 | 6719 |
oldState := true |
712 | 6720 |
] ifFalse:[ |
1699 | 6721 |
oldState := isVisible value. |
6722 |
isVisible isValueModel ifTrue:[ |
|
6723 |
isVisible removeDependent:self |
|
6724 |
] |
|
712 | 6725 |
]. |
6726 |
isVisible := something. |
|
6727 |
||
6728 |
isVisible isNil ifTrue:[ |
|
1699 | 6729 |
newState := true |
712 | 6730 |
] ifFalse:[ |
1699 | 6731 |
isVisible isValueModel ifTrue:[ |
6732 |
isVisible addDependent:self |
|
6733 |
] ifFalse:[ |
|
6734 |
isVisible isSymbol ifTrue:[^ self] |
|
6735 |
]. |
|
6736 |
menuPanel shown ifFalse:[^ self]. |
|
6737 |
newState := isVisible value. |
|
712 | 6738 |
]. |
6739 |
||
6740 |
newState ~~ oldState ifTrue:[ |
|
1699 | 6741 |
menuPanel mustRearrange |
712 | 6742 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
6743 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
6744 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 6745 |
! |
6746 |
||
388 | 6747 |
shortcutKeyAsString |
6748 |
"converts shortcutKey to a text object |
|
6749 |
" |
|
1609 | 6750 |
|nm prefix| |
6751 |
||
6752 |
shortcutKey isNil ifTrue:[ |
|
6753 |
^ nil |
|
6754 |
]. |
|
6755 |
||
6756 |
shortcutKey isCharacter ifTrue:[ |
|
6757 |
nm := shortcutKey asString |
|
388 | 6758 |
] ifFalse:[ |
1609 | 6759 |
"/ this is somewhat complicated: we have the symbolic key at hand, |
6760 |
"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
|
6761 |
"/ Ask the devices keyboardMap for the backtranslation. |
|
6762 |
||
6763 |
nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey. |
|
6764 |
"/ |
|
6765 |
"/ some modifier-key combination ? |
|
6766 |
"/ |
|
6767 |
(nm startsWith:#Cmd) ifTrue:[ |
|
6768 |
prefix := #Cmd. |
|
6769 |
] ifFalse:[(nm startsWith:#Alt) ifTrue:[ |
|
6770 |
prefix := #Alt. |
|
6771 |
] ifFalse:[(nm startsWith:#Meta) ifTrue:[ |
|
6772 |
prefix := #Meta. |
|
6773 |
] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[ |
|
6774 |
prefix := #Ctrl. |
|
6775 |
]]]]. |
|
6776 |
prefix notNil ifTrue:[ |
|
6777 |
nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1)) |
|
6778 |
] ifFalse:[ |
|
6779 |
nm := nm asString |
|
6780 |
] |
|
388 | 6781 |
]. |
608 | 6782 |
^ nm |
388 | 6783 |
|
987 | 6784 |
"Modified: / 17.7.1998 / 11:56:40 / cg" |
388 | 6785 |
! |
6786 |
||
6787 |
shortcutKeyPrefixFor:aModifier |
|
6788 |
"returns prefix assigned to a modifier |
|
6789 |
" |
|
6790 |
|m| |
|
6791 |
||
6792 |
m := menuPanel device modifierKeyTopFor:aModifier. |
|
6793 |
m notNil ifTrue:[ |
|
1117 | 6794 |
^ m , '-' |
388 | 6795 |
]. |
987 | 6796 |
^ aModifier , '-'. |
6797 |
||
6798 |
"Modified: / 17.7.1998 / 11:56:46 / cg" |
|
388 | 6799 |
! ! |
6800 |
||
6801 |
!MenuPanel::Item methodsFor:'selection'! |
|
6802 |
||
6803 |
isSelected |
|
6804 |
"returns true if item is selected |
|
6805 |
" |
|
1998 | 6806 |
|
6807 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 6808 |
! |
6809 |
||
1701 | 6810 |
selected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
6811 |
"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
|
6812 |
submenu and perform a redraw |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
6813 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6814 |
menuPanel isNil ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6815 |
^ self hideSubmenu |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6816 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6817 |
|
1701 | 6818 |
isSelected ifFalse:[ |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6819 |
self invalidate. |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
6820 |
self hideSubmenu. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6821 |
] ifTrue:[ |
1701 | 6822 |
menuPanel realized ifTrue:[ |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6823 |
(indication isNil or:[isButton not]) ifTrue:[ |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6824 |
self invalidate |
1701 | 6825 |
]. |
6826 |
||
1788 | 6827 |
(menuPanel isPopUpView not or:[menuPanel openMenuOnSelect]) ifTrue:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6828 |
(subMenu := self setupSubmenu) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6829 |
self openSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6830 |
] |
1701 | 6831 |
] |
6832 |
] |
|
6833 |
]. |
|
388 | 6834 |
! ! |
6835 |
||
2016 | 6836 |
!MenuPanel::Scrolling class methodsFor:'default icons'! |
6837 |
||
2018 | 6838 |
icon |
2016 | 6839 |
"This resource specification was automatically generated |
6840 |
by the ImageEditor of ST/X." |
|
6841 |
||
6842 |
"Do not manually edit this!! If it is corrupted, |
|
6843 |
the ImageEditor may not be able to read the specification." |
|
6844 |
||
6845 |
" |
|
2018 | 6846 |
self icon inspect |
6847 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 6848 |
" |
6849 |
||
6850 |
<resource: #image> |
|
6851 |
||
6852 |
^Icon |
|
2018 | 6853 |
constantNamed:#'MenuPanel::Scrolling class icon' |
6854 |
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 | 6855 |
! ! |
6856 |
||
6857 |
!MenuPanel::Scrolling class methodsFor:'instance creation'! |
|
6858 |
||
6859 |
new |
|
6860 |
^ self basicNew initialize |
|
6861 |
! ! |
|
6862 |
||
6863 |
!MenuPanel::Scrolling methodsFor:'accessing'! |
|
6864 |
||
6865 |
activeMenu |
|
6866 |
"returns the active menu the scrolling is activated on; nil |
|
6867 |
is returned if scrolling is deactivated |
|
6868 |
" |
|
6869 |
^ activeMenu |
|
6870 |
! |
|
6871 |
||
6872 |
direction |
|
6873 |
"returns the scroll-direction |
|
6874 |
" |
|
6875 |
^ direction |
|
6876 |
! |
|
6877 |
||
6878 |
iconAt:aDirection on:aMenu |
|
2018 | 6879 |
|icon device index| |
2016 | 6880 |
|
6881 |
device := aMenu device. |
|
6882 |
||
6883 |
aDirection == #PREV ifTrue:[ |
|
2018 | 6884 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
6885 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
6886 |
] ifFalse:[ |
|
6887 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
|
6888 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
6889 |
]. |
|
6890 |
||
6891 |
icon := icons at:index. |
|
6892 |
||
6893 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
6894 |
icon := self class icon. |
|
6895 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
6896 |
ifFalse:[ icon := icon copy ]. |
|
6897 |
||
6898 |
icon := icon onDevice:device. |
|
6899 |
icon clearMaskedPixels. |
|
6900 |
icons at:index put:icon |
|
6901 |
]. |
|
6902 |
^ icon |
|
2016 | 6903 |
! ! |
6904 |
||
6905 |
!MenuPanel::Scrolling methodsFor:'initialization'! |
|
6906 |
||
6907 |
initialize |
|
6908 |
||
6909 |
semaLock := RecursionLock new. |
|
2018 | 6910 |
icons := Array new:4. |
2016 | 6911 |
! ! |
6912 |
||
6913 |
!MenuPanel::Scrolling methodsFor:'queries'! |
|
6914 |
||
6915 |
isActive |
|
6916 |
"returns true if scrolling is activated |
|
6917 |
" |
|
6918 |
^ activeMenu notNil |
|
6919 |
! ! |
|
6920 |
||
6921 |
!MenuPanel::Scrolling methodsFor:'user operations'! |
|
6922 |
||
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6923 |
startIfRequiredAt:aDirection on:aMenu |
2016 | 6924 |
"start scrolling; returns true if scrolling is activated |
6925 |
" |
|
6926 |
|bounds index| |
|
6927 |
||
6928 |
semaLock critical:[ |
|
6929 |
self stop. |
|
6930 |
||
6931 |
( aDirection notNil |
|
6932 |
and:[aMenu notNil |
|
6933 |
and:[(bounds := aMenu scrollerBoundsAt:aDirection) notNil]] |
|
6934 |
) ifTrue:[ |
|
6935 |
activeMenu := aMenu. |
|
6936 |
direction := aDirection. |
|
6937 |
||
6938 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
6939 |
||
6940 |
index ~~ 0 ifTrue:[ |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6941 |
scrollTask := |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6942 |
[ |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6943 |
|item step| |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6944 |
|
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6945 |
[ |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6946 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6947 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6948 |
aMenu makeItemVisible:item. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6949 |
index := index + step. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6950 |
]. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6951 |
|
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6952 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6953 |
|
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6954 |
[ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[ |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6955 |
aMenu makeItemVisible:item. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6956 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6957 |
index := index + step. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6958 |
]. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6959 |
item := nil. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6960 |
] valueNowOrOnUnwindDo:[ |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6961 |
scrollTask := nil. |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6962 |
|
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6963 |
item notNil ifTrue:[ |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6964 |
"/ process was killed |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6965 |
aMenu invalidate:bounds |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6966 |
] |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6967 |
] |
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6968 |
] forkAt:8. |
2016 | 6969 |
] |
6970 |
] |
|
6971 |
]. |
|
6972 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
6973 |
|
2048 | 6974 |
"Created: ca" |
6975 |
||
6976 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 6977 |
! |
6978 |
||
6979 |
stop |
|
6980 |
"stop scrolling; returns true if the scrolling was activated otherwise false |
|
6981 |
" |
|
6982 |
|task resp| |
|
6983 |
||
6984 |
activeMenu isNil ifTrue:[ |
|
6985 |
^ false |
|
6986 |
]. |
|
6987 |
semaLock critical:[ |
|
6988 |
resp := activeMenu notNil. |
|
6989 |
||
6990 |
(task := scrollTask) notNil ifTrue:[ |
|
6991 |
scrollTask := nil. |
|
6992 |
||
6993 |
Error handle:[:ex| |
|
6994 |
] do:[ |
|
6995 |
task terminateWithAllSubprocesses. |
|
6996 |
task waitUntilTerminated. |
|
6997 |
]. |
|
6998 |
]. |
|
6999 |
activeMenu := direction := nil. |
|
7000 |
]. |
|
7001 |
^ resp |
|
7002 |
! ! |
|
7003 |
||
388 | 7004 |
!MenuPanel class methodsFor:'documentation'! |
7005 |
||
7006 |
version |
|
2062 | 7007 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.292 2001-12-11 11:53:42 cg Exp $' |
388 | 7008 |
! ! |
7009 |
MenuPanel initialize! |