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