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