author | ca |
Mon, 11 Nov 2002 11:29:41 +0100 | |
changeset 2364 | c72f35819bda |
parent 2362 | 7a0f2e986289 |
child 2372 | d136f6d4b7c5 |
permissions | -rw-r--r-- |
2005 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
2145 | 3 |
All Rights Reserved |
2005 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
1750 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
2182
59a770bbb95a
changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
16 |
View subclass:#MenuPanel |
2145 | 17 |
instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu |
2219 | 18 |
shortKeyInset selection items groupSizes receiver enabled |
19 |
lastActiveMenu enteredItem prevFocusView previousPointerGrab |
|
20 |
previousKeyboardGrab relativeGrabOrigin hasImplicitGrap |
|
2253 | 21 |
scrollActivity rightArrowShadow rightArrow fgColor verticalLayout |
22 |
showSeparatingLines showGroupDivider implicitGrabView |
|
2331 | 23 |
lastPointerView openDelayedMenuBlock preferredWidth application |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
24 |
originator centerItems hideOnRelease defaultHideOnRelease' |
2253 | 25 |
classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages' |
2145 | 26 |
poolDictionaries:'' |
27 |
category:'Views-Menus' |
|
388 | 28 |
! |
29 |
||
30 |
Object subclass:#Item |
|
2359 | 31 |
instanceVariableNames:'menuItem layout menuPanel subMenu rawLabel rawLabelExtent |
2360 | 32 |
disabledRawLabel enableChannel label activeHelpText flyByHelpText |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
33 |
isVisible indication choice accessCharacter font' |
2145 | 34 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
35 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
|
36 |
poolDictionaries:'' |
|
37 |
privateIn:MenuPanel |
|
388 | 38 |
! |
39 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
40 |
Object subclass:#ScrollActivity |
2145 | 41 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
42 |
classVariableNames:'' |
|
43 |
poolDictionaries:'' |
|
44 |
privateIn:MenuPanel |
|
2016 | 45 |
! |
46 |
||
388 | 47 |
!MenuPanel class methodsFor:'documentation'! |
48 |
||
2005 | 49 |
copyright |
50 |
" |
|
51 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
2145 | 52 |
All Rights Reserved |
2005 | 53 |
|
54 |
This software is furnished under a license and may be used |
|
55 |
only in accordance with the terms of that license and with the |
|
56 |
inclusion of the above copyright notice. This software may not |
|
57 |
be provided or otherwise made available to, or used by, any |
|
58 |
other person. No title to or ownership of the software is |
|
59 |
hereby transferred. |
|
60 |
" |
|
61 |
||
388 | 62 |
! |
63 |
||
64 |
documentation |
|
65 |
" |
|
66 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
67 |
||
2170 | 68 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
388 | 69 |
(and hopefully be ST-80 compatible ...) |
70 |
||
502 | 71 |
To create a menu, there exists a MenuEditor which will generate |
72 |
a menu specification. |
|
73 |
||
74 |
||
2061 | 75 |
Notice: |
76 |
This is going to replace the obsolete MenuView. |
|
77 |
||
388 | 78 |
[author:] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
79 |
Claus Atzkern |
388 | 80 |
|
81 |
[see also:] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
82 |
Menu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
83 |
MenuItem |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
84 |
MenuEditor |
2170 | 85 |
|
86 |
cg: this code is so ugly - needs a complete rewrite... |
|
87 |
||
388 | 88 |
" |
89 |
! |
|
90 |
||
91 |
examples |
|
92 |
||
93 |
" |
|
94 |
start as PullDownMenu |
|
2219 | 95 |
[exBegin] |
388 | 96 |
|top subView mview desc s1 s2 s3 img lbs labels| |
97 |
||
98 |
top := StandardSystemView new. |
|
99 |
||
436 | 100 |
mview := MenuPanel in:top. |
388 | 101 |
|
502 | 102 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 103 |
mview level:2. |
104 |
mview verticalLayout:false. |
|
105 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 106 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 107 |
mview labels:lbs. |
108 |
mview shortcutKeyAt:2 put:#Cut. |
|
109 |
mview accessCharacterPositionAt:1 put:1. |
|
110 |
mview accessCharacterPositionAt:2 put:2. |
|
111 |
||
112 |
mview enabledAt:5 put:false. |
|
113 |
mview groupSizes:#( 2 2 ). |
|
436 | 114 |
s1 := MenuPanel labels:labels. |
388 | 115 |
s1 accessCharacterPositionAt:1 put:1. |
116 |
s1 accessCharacterPositionAt:2 put:2. |
|
117 |
s1 groupSizes:#( 2 2 ). |
|
436 | 118 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
119 |
s3 := MenuPanel labels:lbs. |
|
388 | 120 |
|
121 |
s1 subMenuAt:2 put:s2. |
|
436 | 122 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 123 |
s2 subMenuAt:3 put:s3. |
436 | 124 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 125 |
s3 shortcutKeyAt:3 put:$q. |
126 |
||
127 |
mview subMenuAt:1 put:s1. |
|
436 | 128 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 129 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
130 |
s1 shortcutKeyAt:1 put:#Copy. |
|
131 |
s1 shortcutKeyAt:3 put:#Paste. |
|
132 |
||
436 | 133 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 134 |
top extent:(mview preferredExtent). |
388 | 135 |
top open. |
2219 | 136 |
[exEnd] |
137 |
||
138 |
[exBegin] |
|
1767 | 139 |
|top menu view item| |
140 |
||
141 |
top := StandardSystemView extent:240@100. |
|
142 |
menu := MenuPanel in:top. |
|
143 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
144 |
menu verticalLayout:false. |
|
145 |
||
146 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
147 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
148 |
||
149 |
view := ClockView new. |
|
150 |
view preferredExtent:100@100. |
|
151 |
item := menu itemAt:3. |
|
152 |
item submenu:view. |
|
153 |
||
154 |
view := SimpleView new. |
|
155 |
view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new). |
|
156 |
view preferredExtent:(400@50). |
|
157 |
item := menu itemAt:2. |
|
158 |
item submenu:view. |
|
159 |
||
160 |
menu origin:0@0 corner:1.0@30. |
|
161 |
top open. |
|
2219 | 162 |
[exEnd] |
388 | 163 |
|
164 |
||
165 |
start as PopUpMenu |
|
2219 | 166 |
[exBegin] |
388 | 167 |
|subView mview desc s1 s2 s3 img lbs labels| |
168 |
||
436 | 169 |
mview := MenuPanel new. |
502 | 170 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 171 |
mview level:2. |
172 |
||
173 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 174 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 175 |
mview labels:lbs. |
176 |
||
436 | 177 |
s1 := MenuPanel labels:labels. |
178 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
179 |
s3 := MenuPanel labels:lbs. |
|
388 | 180 |
s1 subMenuAt:2 put:s2. |
436 | 181 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 182 |
s2 subMenuAt:3 put:s3. |
436 | 183 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 184 |
s3 shortcutKeyAt:3 put:$q. |
185 |
||
186 |
mview subMenuAt:1 put:s1. |
|
436 | 187 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 188 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
189 |
s1 shortcutKeyAt:1 put:#Copy. |
|
190 |
s1 shortcutKeyAt:3 put:#Paste. |
|
191 |
||
436 | 192 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 193 |
mview startUp |
2219 | 194 |
[exEnd] |
388 | 195 |
|
196 |
||
197 |
start from menu spec |
|
2219 | 198 |
[exBegin] |
388 | 199 |
|menu| |
200 |
||
436 | 201 |
menu := MenuPanel menu: |
2219 | 202 |
#(#Menu #( #(#MenuItem |
203 |
#label: 'File' |
|
204 |
#submenu: |
|
205 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
206 |
(#MenuItem |
|
207 |
#label: 'edit' |
|
208 |
#submenu: |
|
209 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
210 |
#(#MenuItem #label: 'close' #value:#close) |
|
211 |
) |
|
212 |
nil |
|
213 |
nil |
|
214 |
) |
|
215 |
) |
|
216 |
#(#MenuItem #label: 'help' #value:#help ) |
|
217 |
) |
|
218 |
nil |
|
219 |
nil |
|
220 |
) |
|
221 |
) |
|
222 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
223 |
#(#MenuItem #label: 'Bar' |
|
224 |
#submenu: |
|
225 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
226 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
227 |
) |
|
228 |
nil |
|
229 |
nil |
|
230 |
) |
|
231 |
) |
|
232 |
) |
|
233 |
#( 2 ) |
|
234 |
nil |
|
235 |
) decodeAsLiteralArray. |
|
388 | 236 |
|
237 |
menu verticalLayout:false. |
|
238 |
Transcript showCR:(menu startUp). |
|
2219 | 239 |
[exEnd] |
388 | 240 |
|
241 |
" |
|
242 |
||
243 |
! ! |
|
244 |
||
245 |
!MenuPanel class methodsFor:'instance creation'! |
|
246 |
||
247 |
fromSpec:aSpec |
|
248 |
^ self fromSpec:aSpec receiver:nil |
|
249 |
! |
|
250 |
||
251 |
fromSpec:aSpec receiver:aReceiver |
|
252 |
|menu| |
|
253 |
||
254 |
aSpec notNil ifTrue:[ |
|
2219 | 255 |
menu := Menu new. |
256 |
menu receiver:aReceiver. |
|
257 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 258 |
]. |
259 |
^ self menu:menu receiver:aReceiver |
|
260 |
! |
|
261 |
||
262 |
labels:labels |
|
263 |
^ self labels:labels nameKeys:nil receiver:nil |
|
264 |
! |
|
265 |
||
266 |
labels:labels nameKeys:nameKeys |
|
267 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
268 |
! |
|
269 |
||
270 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
271 |
|mview| |
|
272 |
||
273 |
mview := self menu:nil receiver:aReceiver. |
|
274 |
mview labels:labels. |
|
275 |
mview nameKeys:nameKeys. |
|
276 |
^ mview |
|
277 |
||
278 |
! |
|
279 |
||
502 | 280 |
labels:labels receiver:aReceiver |
281 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
282 |
! |
|
283 |
||
388 | 284 |
menu:aMenu |
285 |
^ self menu:aMenu receiver:nil |
|
286 |
! |
|
287 |
||
288 |
menu:aMenu receiver:aReceiver |
|
289 |
|mview| |
|
290 |
||
291 |
mview := self new. |
|
1955 | 292 |
|
293 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
2219 | 294 |
"/ no receiver specified in the menu; thus set the receiver immediately |
295 |
mview receiver:aReceiver |
|
1955 | 296 |
]. |
297 |
||
388 | 298 |
mview menu:aMenu. |
299 |
||
1955 | 300 |
|
388 | 301 |
"/ a menu itself may contain a receiver |
302 |
"/ thus we do not overwrite the receiver |
|
303 |
||
304 |
aReceiver notNil ifTrue:[ |
|
2219 | 305 |
mview receiver:aReceiver |
388 | 306 |
]. |
307 |
^ mview |
|
308 |
! ! |
|
309 |
||
310 |
!MenuPanel class methodsFor:'class initialization'! |
|
311 |
||
312 |
initialize |
|
657 | 313 |
" |
314 |
self initialize |
|
315 |
" |
|
316 |
||
388 | 317 |
InitialSelectionQuerySignal isNil ifTrue:[ |
2253 | 318 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 319 |
]. |
320 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
321 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 322 |
! |
323 |
||
324 |
preSnapshot |
|
325 |
"remove all resources |
|
326 |
" |
|
327 |
Images := nil. |
|
328 |
LigthenedImages := nil. |
|
329 |
||
616 | 330 |
! ! |
331 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
332 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
333 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
334 |
delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
335 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
336 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
337 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
338 |
"Do not manually edit this!! If it is corrupted, |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
339 |
the ImageEditor may not be able to read the specification." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
340 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
341 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
342 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
343 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
344 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
345 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
346 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
347 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
348 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
349 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
350 |
constantNamed:#'MenuPanel class delayedMenuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
351 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 6; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@HCB') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 6; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@J+V[C P') ; yourself); yourself] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
352 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
353 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
354 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
355 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
356 |
by the ImageEditor of ST/X." |
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 |
"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
|
359 |
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
|
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 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
363 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
364 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
365 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
366 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
367 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
368 |
^Icon |
2219 | 369 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
370 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
371 |
! |
1798
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 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
374 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
375 |
by the ImageEditor of ST/X." |
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 |
"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
|
378 |
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
|
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 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
382 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
383 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
384 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
385 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
386 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
387 |
^Icon |
2219 | 388 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
389 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBO???P#???4H??<=BO?<OP#O<C4H0<C=BL@C?P#0C?4H?C?=BO???P/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
390 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
391 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
392 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
393 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
394 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
397 |
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
|
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 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
401 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
402 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
403 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
404 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
405 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
406 |
^Icon |
2219 | 407 |
constantNamed:#'MenuPanel iconIndicationOff' |
408 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
409 |
! |
1726
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 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
412 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
413 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
416 |
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
|
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 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
420 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
421 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
422 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
423 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
424 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
425 |
^Icon |
2219 | 426 |
constantNamed:#'MenuPanel iconIndicationOn' |
427 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
428 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
429 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
430 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
431 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
432 |
by the ImageEditor of ST/X." |
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 |
"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
|
435 |
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
|
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 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
439 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
440 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
441 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
442 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
443 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
444 |
^Icon |
2219 | 445 |
constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
446 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DZ**(AJ**+AJ***LR***#D***(1J***LR***#AZ**#@Z**(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
447 |
! |
1798
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 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
450 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
451 |
by the ImageEditor of ST/X." |
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 |
"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
|
454 |
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
|
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 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
458 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 459 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
460 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
461 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
462 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
463 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
464 |
^Icon |
2337 | 465 |
constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
466 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DYUZ(AIUU+AIUUVLRUUU#D%UUX1IUUVLRUUU#AYUU#@Z%U(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
467 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
468 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
469 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
470 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
471 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
472 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
473 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
474 |
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
|
475 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
476 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
477 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
478 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
479 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
480 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
481 |
<resource: #image> |
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 |
^Icon |
2219 | 484 |
constantNamed:#'MenuPanel iconRadioGroupOff' |
485 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D_?>(AO??;AO???LS???3D???<1O???LS???3A_??3@Z??<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
486 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
487 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
488 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
489 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
490 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
491 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
492 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
493 |
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
|
494 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
495 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
496 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
497 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
498 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
499 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
500 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
501 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
502 |
^Icon |
2219 | 503 |
constantNamed:#'MenuPanel iconRadioGroupOn' |
504 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D]@^(AL@@;AM@@GLS@@@3D0@@L1L@@CLSP@A3A\@@3@Z4A<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself] |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
505 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
506 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
507 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
508 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
509 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
510 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
511 |
"Do not manually edit this!! If it is corrupted, |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
512 |
the ImageEditor may not be able to read the specification." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
513 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
514 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
515 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
516 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
517 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
518 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
519 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
520 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
521 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
522 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
523 |
constantNamed:#'MenuPanel::Item class menuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
524 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 4; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@B@0 @a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 4; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?''08D@@a') ; yourself); yourself] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
525 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
526 |
|
616 | 527 |
!MenuPanel class methodsFor:'defaults'! |
450 | 528 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
529 |
defaultBackgroundColor |
2219 | 530 |
^ StyleSheet at:#'menuPanel.backgroundColor' |
531 |
! |
|
532 |
||
533 |
defaultFont |
|
534 |
^ StyleSheet at:#'menu.font' |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
535 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
536 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
537 |
defaultLevel |
2219 | 538 |
^ StyleSheet at:#'menuPanel.level' |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
539 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
540 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
541 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
542 |
"returns an additional offset between the label and the |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
543 |
delayedMenu indication (i.e. the down-arrow icon) |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
544 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
545 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
546 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
547 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
548 |
menuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
549 |
"returns an additional offset between the label and the |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
550 |
delayedMenu indication (i.e. the down-arrow icon) |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
551 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
552 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
553 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
554 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
555 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
556 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
557 |
ex: |
2219 | 558 |
&File mnemonic := Cmdf |
559 |
F&ile mnemonic := Cmdi |
|
560 |
..... |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
561 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
562 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
563 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
564 |
|
450 | 565 |
updateStyleCache |
657 | 566 |
|
2219 | 567 |
<resource: #style ( |
568 |
#'popup.borderWidth' #'popup.level' |
|
569 |
#'selection.disabledForegroundColor' |
|
570 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
571 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
572 |
#'menu.buttonItemVerticalSpace' |
|
573 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
|
574 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
575 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
576 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
577 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
578 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
579 |
#'menu.selectionFollowsMouse' |
|
580 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
581 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
582 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
583 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
584 |
)> |
|
585 |
||
586 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
587 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel| |
|
588 |
" |
|
589 |
self updateStyleCache |
|
590 |
" |
|
591 |
MenuView updateStyleCache. |
|
592 |
SelectionInListView updateStyleCache. |
|
1699 | 593 |
|
594 |
styleSheet := StyleSheet. |
|
595 |
style := styleSheet name. |
|
596 |
||
2219 | 597 |
foregroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' default:Color black. |
598 |
styleSheet at:#'menuPanel.foregroundColor' put:foregroundColor. |
|
599 |
||
600 |
backgroundColor := styleSheet colorAt:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
|
601 |
styleSheet at:#'menuPanel.backgroundColor' put:backgroundColor. |
|
602 |
||
603 |
var := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
|
604 |
var ifNil:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
605 |
styleSheet at:#'menuPanel.buttonInsetX' put:(var abs). |
|
606 |
||
607 |
var := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
608 |
var ifNil:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
609 |
styleSheet at:#'menuPanel.buttonInsetY' put:(var abs). |
|
610 |
||
611 |
var := styleSheet at:#'menuPanel.level' default:nil. |
|
612 |
var isNil ifTrue:[ var := styleSheet at:#'pullDownMenu.level' default:1 ]. |
|
613 |
styleSheet at:#'menuPanel.level' put:var. |
|
614 |
||
615 |
var := styleSheet at:#'menu.itemHorizontalSpace'. |
|
616 |
var ifNil:[ var := styleSheet at:#'menu.itemSpace' default:0 ]. |
|
617 |
styleSheet at:#'menuPanel.itemSpace' put:var. |
|
618 |
||
619 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
620 |
var ifNil:[ |
|
621 |
style == #motif ifTrue:[ var := backgroundColor ] |
|
622 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
623 |
]. |
|
624 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
625 |
||
626 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
627 |
var ifNil:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
|
628 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
|
629 |
||
630 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
631 |
var ifNil:[ |
|
632 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
|
633 |
var ifNil:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
|
634 |
]. |
|
635 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
636 |
||
637 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
638 |
var ifNil:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
|
639 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
|
640 |
||
641 |
||
642 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
643 |
buttonActiveLevel ifNil:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
|
644 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
|
645 |
||
646 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
647 |
buttonPassiveLevel ifNil:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
|
648 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
|
649 |
||
650 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
651 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
652 |
||
653 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
654 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
655 |
||
656 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
657 |
buttonPassiveBackgroundColor ifNil:[ |
|
658 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
|
659 |
]. |
|
660 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
661 |
||
662 |
var := styleSheet at:#'button.lightColor'. |
|
663 |
var ifNil:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
|
664 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
|
665 |
||
666 |
var := styleSheet at:#'button.shadowColor'. |
|
667 |
var ifNil:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
|
668 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
|
669 |
||
670 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
671 |
var ifNil:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
|
672 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
|
673 |
||
674 |
Item updateStyleCache. |
|
388 | 675 |
! ! |
676 |
||
794 | 677 |
!MenuPanel class methodsFor:'image registration'! |
678 |
||
679 |
image:anImage onDevice:aDevice |
|
680 |
" |
|
681 |
Images := nil |
|
682 |
" |
|
2269 | 683 |
|deviceImages| |
794 | 684 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
685 |
anImage device == aDevice ifTrue:[ |
2269 | 686 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
687 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
688 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
689 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 690 |
|
1097 | 691 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2269 | 692 |
Images at:aDevice put:(deviceImages := Dictionary new) |
693 |
]. |
|
694 |
||
695 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
696 |
image := anImage copy onDevice:aDevice. |
|
697 |
image clearMaskedPixels. |
|
698 |
deviceImages at:anImage put:image. |
|
699 |
image |
|
700 |
]. |
|
794 | 701 |
! |
702 |
||
703 |
lightenedImage:anImage onDevice:aDevice |
|
704 |
" |
|
705 |
LigthenedImages := nil |
|
706 |
" |
|
1097 | 707 |
|deviceImages image| |
794 | 708 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
709 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 710 |
|
1097 | 711 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2219 | 712 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 713 |
]. |
714 |
||
715 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
2219 | 716 |
^ image |
794 | 717 |
]. |
718 |
||
719 |
((anImage respondsTo:#colorMap) and:[anImage colorMap notNil]) ifTrue:[ |
|
2219 | 720 |
image := anImage copy lightened onDevice:aDevice. |
721 |
image clearMaskedPixels. |
|
794 | 722 |
] ifFalse:[ |
2219 | 723 |
image := self image:anImage onDevice:aDevice |
794 | 724 |
]. |
1097 | 725 |
deviceImages at:anImage put:image. |
794 | 726 |
^ image |
727 |
||
728 |
||
729 |
! ! |
|
730 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
731 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
732 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
733 |
subMenu:aSubMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
734 |
"create a submenu; can be redifined in derived classes |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
735 |
" |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
736 |
^ (self new) menu:aSubMenu. |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
737 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
738 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
739 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
740 |
|
1808 | 741 |
!MenuPanel methodsFor:'accepting'! |
389 | 742 |
|
743 |
accept |
|
744 |
"accept current selected item |
|
745 |
" |
|
1670 | 746 |
^ self acceptItem:(self selection) inMenu:self |
389 | 747 |
! |
748 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
749 |
accept:anItem |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
750 |
"this is the topMenu: accept item " |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
751 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
752 |
|value item tgState itemIdx recv panel masterGroup winGrp acceptAction| |
1630 | 753 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
754 |
self superMenu notNil ifTrue:[ |
2253 | 755 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
756 |
]. |
2199 | 757 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
758 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
759 |
self selection:nil. |
420 | 760 |
|
761 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
2253 | 762 |
tgState := anItem toggleIndication. |
763 |
panel := anItem menuPanel. |
|
764 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
765 |
item := anItem. |
|
766 |
recv := panel receiver. |
|
389 | 767 |
]. |
1699 | 768 |
self doUngrab:true. |
389 | 769 |
|
510 | 770 |
self isPopUpView ifFalse:[ |
2253 | 771 |
self do:[:el| el updateIndicators]. |
772 |
self windowGroup processExposeEvents. |
|
524 | 773 |
] ifTrue:[ |
2253 | 774 |
self unmap. |
775 |
(winGrp := self windowGroup) notNil ifTrue:[ |
|
776 |
"/ give expose event a chance to arrive |
|
777 |
[shown and:[realized]] whileTrue:[ |
|
778 |
winGrp processExposeEventsFor:self |
|
779 |
]. |
|
780 |
masterGroup := winGrp previousGroup. |
|
781 |
]. |
|
782 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
783 |
"/ self destroy. |
|
784 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
524 | 785 |
]. |
1710 | 786 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
787 |
acceptAction := [ value := self accept:item index:itemIdx toggle:tgState receiver:recv ]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
788 |
|
1710 | 789 |
(item notNil |
790 |
and:[item showBusyCursorWhilePerforming |
|
791 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
792 |
ifTrue:[ |
|
2253 | 793 |
winGrp withWaitCursorDo:acceptAction |
2132 | 794 |
] ifFalse:[acceptAction value]. |
524 | 795 |
|
796 |
self isPopUpView ifTrue:[ |
|
2253 | 797 |
self menuAdornmentAt:#item put:item. |
524 | 798 |
]. |
1699 | 799 |
^ item. |
524 | 800 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
801 |
"Modified: / 15.11.2001 / 17:05:40 / cg" |
524 | 802 |
! |
803 |
||
804 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
805 |
"accept an item |
|
806 |
" |
|
2253 | 807 |
|value argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
808 |
app master fallBack| |
524 | 809 |
|
810 |
anItem isNil ifTrue:[ |
|
2253 | 811 |
self menuAdornmentAt:#hasPerformed put:true. |
812 |
^ nil |
|
813 |
]. |
|
814 |
||
815 |
isValueModel := aReceiver isValueModel. |
|
816 |
||
817 |
self menuAdornmentAt:#hasPerformed put:isValueModel. |
|
524 | 818 |
|
819 |
(value := anItem value) isNil ifTrue:[ |
|
2253 | 820 |
^ anIndex |
524 | 821 |
]. |
822 |
||
823 |
(argument := anItem argument) isNil ifTrue:[ |
|
2253 | 824 |
argument := aState ? anItem |
389 | 825 |
]. |
524 | 826 |
|
827 |
value isSymbol ifFalse:[ |
|
2253 | 828 |
"/ a valueHolder or block |
829 |
(value respondsTo:#valueWithArguments:) ifFalse:[ |
|
830 |
^ value |
|
831 |
]. |
|
832 |
||
833 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
|
834 |
||
835 |
numArgs == 0 ifTrue:[ |
|
836 |
args := nil |
|
837 |
] ifFalse:[ |
|
838 |
numArgs == 1 ifTrue:[ |
|
839 |
args := Array with:argument |
|
840 |
] ifFalse:[ |
|
841 |
args := Array with:argument with:self |
|
842 |
] |
|
843 |
]. |
|
844 |
||
845 |
value valueWithArguments:args. |
|
846 |
||
847 |
self menuAdornmentAt:#hasPerformed put:true. |
|
848 |
^ anIndex |
|
524 | 849 |
]. |
850 |
||
2331 | 851 |
anItem sendToOriginator ifTrue:[ |
852 |
rec := self originator |
|
853 |
] ifFalse:[ |
|
854 |
rec := aReceiver |
|
855 |
]. |
|
856 |
||
857 |
rec isNil ifTrue:[ |
|
2253 | 858 |
^ value |
859 |
]. |
|
860 |
||
861 |
isValueModel ifTrue:[ |
|
2331 | 862 |
rec value:value |
465 | 863 |
] ifFalse:[ |
2253 | 864 |
arg2 := self. |
865 |
||
866 |
"/ support for ST80 style applications |
|
867 |
"/ (expecting the message to go to the application |
|
868 |
"/ if not understood by the view) |
|
869 |
"/ These expect the controller to be passed as argument. |
|
870 |
"/ sigh. |
|
871 |
||
2331 | 872 |
(rec isView |
873 |
and:[(rec respondsTo:value) not |
|
874 |
and:[(app := rec application) ~~ rec |
|
2253 | 875 |
and:[app notNil]]]) ifTrue:[ |
2331 | 876 |
arg2 := rec controller. "/ the Views controller |
2253 | 877 |
rec := app. |
878 |
]. |
|
879 |
||
880 |
(numArgs := value numArgs) == 0 ifTrue:[ |
|
881 |
args := nil |
|
882 |
] ifFalse:[ |
|
883 |
numArgs == 1 ifTrue:[ |
|
884 |
args := Array with:argument |
|
885 |
] ifFalse:[ |
|
886 |
args := Array with:argument with:arg2 |
|
887 |
] |
|
888 |
]. |
|
889 |
||
890 |
fallBack := |
|
891 |
[ |
|
892 |
"/ mhmh - the receiver did not respond to that message; |
|
893 |
"/ if there is a master-application, try that one |
|
894 |
"/ (recursive) |
|
895 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
896 |
master notNil ifTrue:[ |
|
897 |
rec := master. |
|
898 |
rec perform:value withArguments:args ifNotUnderstood:fallBack |
|
899 |
] ifFalse:[ |
|
900 |
self |
|
901 |
error:'unimplemented (or error in) menu message: ' , value |
|
902 |
mayProceed:true |
|
903 |
]. |
|
904 |
]. |
|
905 |
||
906 |
rec perform:value withArguments:args ifNotUnderstood:fallBack. |
|
420 | 907 |
]. |
524 | 908 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
909 |
^ value |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
910 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
911 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 912 |
! |
913 |
||
1670 | 914 |
acceptItem:anItem inMenu:aMenu |
2199 | 915 |
|tgState topMenu| |
916 |
||
917 |
topMenu := self topMenu. |
|
918 |
topMenu openDelayed:nil. |
|
1670 | 919 |
|
1841 | 920 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
2219 | 921 |
topMenu accept:anItem |
1670 | 922 |
] ifFalse:[ |
2219 | 923 |
anItem canAccept ifTrue:[ |
924 |
tgState := anItem toggleIndication. |
|
925 |
||
926 |
self accept:anItem |
|
927 |
index:(aMenu selectionIndex) |
|
928 |
toggle:tgState |
|
929 |
receiver:(aMenu receiver). |
|
930 |
||
931 |
aMenu do:[:el| el updateIndicators]. |
|
932 |
] |
|
1670 | 933 |
] |
934 |
! |
|
935 |
||
389 | 936 |
lastItemAccepted |
937 |
"returns last item selected or nil |
|
938 |
" |
|
390 | 939 |
^ self topMenu menuAdornmentAt:#item |
389 | 940 |
! |
941 |
||
942 |
lastValueAccepted |
|
943 |
"returns last value accepted or nil |
|
944 |
" |
|
2253 | 945 |
^ self lastItemAccepted value |
389 | 946 |
! ! |
947 |
||
388 | 948 |
!MenuPanel methodsFor:'accessing'! |
949 |
||
950 |
accessCharacterPositionAt:stringOrNumber |
|
390 | 951 |
"get the access character position for a textLabel |
388 | 952 |
" |
2059 | 953 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 954 |
! |
955 |
||
956 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
390 | 957 |
"get the access character position for a textLabel |
388 | 958 |
" |
959 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
|
960 |
! |
|
961 |
||
962 |
accessCharacterPositions |
|
963 |
"returns a collection of accessCharacterPosition's or nil |
|
964 |
" |
|
965 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
|
966 |
||
967 |
! |
|
968 |
||
969 |
accessCharacterPositions:something |
|
970 |
"define accessCharacterPosition's for each item |
|
971 |
" |
|
972 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
|
973 |
! |
|
974 |
||
975 |
args |
|
976 |
"returns a collection of argument's or nil |
|
977 |
" |
|
978 |
^ self collect:[:anItem| anItem argument ] |
|
979 |
! |
|
980 |
||
981 |
args:something |
|
982 |
"define arguments for each item |
|
983 |
" |
|
984 |
self onEachPerform:#argument: withArgList:something |
|
985 |
! |
|
986 |
||
987 |
argsAt:stringOrNumber |
|
988 |
"gets the argument of an item or nil |
|
989 |
" |
|
2059 | 990 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 991 |
! |
992 |
||
993 |
argsAt:stringOrNumber put:anArgument |
|
994 |
"sets the argument of an item |
|
995 |
" |
|
996 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
|
997 |
! |
|
998 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
999 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1000 |
"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
|
1001 |
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
|
1002 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1003 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1004 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1005 |
"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
|
1006 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1007 |
|
388 | 1008 |
groupSizes |
1009 |
"gets collection of group sizes |
|
1010 |
" |
|
1011 |
^ groupSizes |
|
1012 |
! |
|
1013 |
||
1014 |
groupSizes:aGroupSizes |
|
1015 |
"sets collection of group sizes |
|
1016 |
" |
|
1017 |
aGroupSizes = groupSizes ifFalse:[ |
|
2145 | 1018 |
groupSizes := aGroupSizes copy. |
1019 |
self mustRearrange. |
|
388 | 1020 |
]. |
1021 |
! |
|
1022 |
||
1023 |
labelAt:stringOrNumber |
|
1024 |
"gets the label of an item or nil |
|
1025 |
" |
|
1026 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
|
1027 |
! |
|
1028 |
||
1029 |
labelAt:stringOrNumber put:aLabel |
|
1030 |
"sets the label of an item |
|
1031 |
" |
|
1032 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
|
1033 |
! |
|
1034 |
||
1035 |
labels |
|
1036 |
"returns a collection of labels's or nil |
|
1037 |
" |
|
1038 |
^ self collect:[:anItem| anItem label ] |
|
1039 |
||
1040 |
! |
|
1041 |
||
1042 |
labels:labels |
|
1043 |
"define labels for each item |
|
1044 |
" |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1045 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1046 |
|
388 | 1047 |
self disabledRedrawDo:[ |
2219 | 1048 |
self removeAll. |
1049 |
size := labels size. |
|
1050 |
||
1051 |
size > 0 ifTrue:[ |
|
1052 |
items := OrderedCollection new:size. |
|
1053 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1054 |
] |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1055 |
]. |
388 | 1056 |
! |
1057 |
||
1999 | 1058 |
menuPerformer:anObject |
1059 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1060 |
from all submenus no specific receiver is defined ). |
|
1061 |
" |
|
1062 |
^ self receiver:anObject |
|
1063 |
! |
|
1064 |
||
388 | 1065 |
nameKeyAt:stringOrNumber |
1066 |
"gets the nameKey of an item or nil |
|
1067 |
" |
|
1068 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
1069 |
! |
|
1070 |
||
1071 |
nameKeyAt:stringOrNumber put:aNameKey |
|
1072 |
"sets the nameKey of an item |
|
1073 |
" |
|
1074 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
|
1075 |
! |
|
1076 |
||
1077 |
nameKeys |
|
1078 |
"returns a collection of nameKeys's or nil |
|
1079 |
" |
|
1080 |
^ self collect:[:anItem| anItem nameKey ] |
|
1081 |
! |
|
1082 |
||
1083 |
nameKeys:something |
|
1084 |
"define nameKeys for each item |
|
1085 |
" |
|
1086 |
self onEachPerform:#nameKey: withArgList:something |
|
1087 |
! |
|
1088 |
||
1089 |
numberOfItems |
|
1090 |
"gets number of items |
|
1091 |
" |
|
1092 |
^ items size |
|
1093 |
! |
|
1094 |
||
2331 | 1095 |
originator |
1096 |
originator notNil ifTrue:[^ originator]. |
|
1097 |
superMenu notNil ifTrue:[ |
|
1098 |
^ superMenu originator |
|
1099 |
]. |
|
1100 |
^ nil |
|
1101 |
! |
|
1102 |
||
388 | 1103 |
receiver |
1104 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1105 |
from all submenus no specific receiver is defined ). |
|
1106 |
" |
|
389 | 1107 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
2145 | 1108 |
^ superMenu receiver |
388 | 1109 |
]. |
389 | 1110 |
^ receiver |
388 | 1111 |
! |
1112 |
||
1113 |
receiver:anObject |
|
1114 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
1115 |
from all submenus no specific receiver is defined ). |
|
1116 |
" |
|
389 | 1117 |
receiver := anObject |
388 | 1118 |
! |
1119 |
||
1120 |
shortcutKeyAt:stringOrNumber |
|
1121 |
"gets the shortCutKey of an item or nil |
|
1122 |
" |
|
1123 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
1124 |
! |
|
1125 |
||
1126 |
shortcutKeyAt:stringOrNumber put:aKey |
|
1127 |
"sets the shortCutKey of an item |
|
1128 |
" |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1129 |
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
|
1130 |
! |
388 | 1131 |
|
1132 |
shortcutKeys |
|
1133 |
"returns a collection of shortcutKey's or nil |
|
1134 |
" |
|
1135 |
^ self collect:[:anItem| anItem shortcutKey ] |
|
1136 |
||
1137 |
! |
|
1138 |
||
1139 |
shortcutKeys:something |
|
1140 |
"define shortcutKey's for each item |
|
1141 |
" |
|
1142 |
self onEachPerform:#shortcutKey: withArgList:something |
|
1143 |
! |
|
1144 |
||
1145 |
valueAt:stringOrNumber |
|
1146 |
"gets value of an item; a block, valueHolder, ... |
|
1147 |
" |
|
1148 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
1149 |
||
1150 |
! |
|
1151 |
||
1152 |
valueAt:stringOrNumber put:someThing |
|
1153 |
"sets value of an item; a block, valueHolder, ... |
|
1154 |
" |
|
1155 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
|
1156 |
||
1157 |
||
1158 |
! |
|
1159 |
||
1160 |
values:something |
|
1161 |
"define values for each item |
|
1162 |
" |
|
1163 |
self onEachPerform:#value: withArgList:something |
|
1164 |
! ! |
|
1165 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1166 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1167 |
|
1168 |
disableAll |
|
498 | 1169 |
"disable all items; not the menu in case of enabled |
388 | 1170 |
" |
498 | 1171 |
self do:[:anItem| anItem enabled:false] |
388 | 1172 |
! |
1173 |
||
1174 |
disableAll:collectionOfIndicesOrNames |
|
1175 |
"disable an collection of items |
|
1176 |
" |
|
1177 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
|
1178 |
||
1179 |
! |
|
1180 |
||
1181 |
enableAll |
|
498 | 1182 |
"enable all items; not the menu in case of disabled |
388 | 1183 |
" |
498 | 1184 |
self do:[:anItem| anItem enabled:true] |
388 | 1185 |
! |
1186 |
||
1187 |
enableAll:collectionOfIndicesOrNames |
|
1188 |
"enable an collection of items |
|
1189 |
" |
|
1190 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
|
1191 |
||
1192 |
! |
|
1193 |
||
1194 |
enabled |
|
1195 |
"returns enabled state |
|
1196 |
" |
|
498 | 1197 |
^ enabled |
388 | 1198 |
! |
1199 |
||
1200 |
enabled:aState |
|
1201 |
"change enabled state of menu |
|
1202 |
" |
|
545 | 1203 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1204 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1205 |
state := aState ? true. |
388 | 1206 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1207 |
enabled ~~ state ifTrue:[ |
2219 | 1208 |
enabled := state. |
1209 |
self invalidate. |
|
498 | 1210 |
]. |
388 | 1211 |
! |
1212 |
||
1213 |
enabledAt:stringOrNumber |
|
1214 |
"gets the enabled state of an item or false |
|
1215 |
" |
|
1216 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
|
1217 |
! |
|
1218 |
||
1219 |
enabledAt:stringOrNumber put:aState |
|
1220 |
"sets the enabled state of an item |
|
1221 |
" |
|
1222 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
|
1223 |
! |
|
1224 |
||
1225 |
isEnabled:stringOrNumber |
|
1226 |
"gets the enabled state of an item or false |
|
1227 |
" |
|
1228 |
^ self enabledAt:stringOrNumber |
|
1229 |
! ! |
|
1230 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1231 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1232 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1233 |
enableChannel:aValueHolder |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1234 |
"set my enableChannel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1235 |
" |
498 | 1236 |
enableChannel notNil ifTrue:[ |
2145 | 1237 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1238 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1239 |
|
498 | 1240 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
2145 | 1241 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1242 |
]. |
498 | 1243 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1244 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1245 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1246 |
menuHolder:aValueHolder |
498 | 1247 |
"set my menuHolder |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1248 |
" |
498 | 1249 |
menuHolder notNil ifTrue:[ |
2145 | 1250 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1251 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1252 |
|
498 | 1253 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
2145 | 1254 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1255 |
]. |
498 | 1256 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1257 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1258 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1259 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1260 |
|
616 | 1261 |
activeBackgroundColor |
1262 |
"get the background drawing color used to highlight selection |
|
1263 |
" |
|
2219 | 1264 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1265 |
! |
1266 |
||
1267 |
activeForegroundColor |
|
1268 |
"get the foreground color used to highlight selections |
|
1269 |
" |
|
2219 | 1270 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1271 |
! |
1272 |
||
390 | 1273 |
backgroundColor |
1274 |
"return the background color |
|
1275 |
" |
|
502 | 1276 |
^ super viewBackground |
390 | 1277 |
! |
1278 |
||
1279 |
backgroundColor:aColor |
|
1280 |
"set the background drawing color. You should not use this method; |
|
1281 |
instead leave the value as defined in the styleSheet. |
|
1282 |
" |
|
616 | 1283 |
super viewBackground ~~ aColor ifTrue:[ |
2145 | 1284 |
super viewBackground:aColor. |
1285 |
shown ifTrue:[ |
|
1286 |
self invalidate "/ RepairNow:true |
|
1287 |
] |
|
616 | 1288 |
] |
1289 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1290 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1291 |
! |
1292 |
||
727 | 1293 |
buttonActiveBackgroundColor |
1294 |
"get the background drawing color used to highlight button selection |
|
1295 |
" |
|
2219 | 1296 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
1297 |
default:(self viewBackground) |
|
727 | 1298 |
! |
1299 |
||
730 | 1300 |
buttonEdgeStyle |
1301 |
"get the button edge style |
|
1302 |
" |
|
2219 | 1303 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1304 |
! |
1305 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1306 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1307 |
"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
|
1308 |
" |
2219 | 1309 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1310 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1311 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1312 |
buttonEnteredLevel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1313 |
"get the 3D-level used to highlight entered button items |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1314 |
" |
2219 | 1315 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1316 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1317 |
|
730 | 1318 |
buttonHalfLightColor |
1319 |
"get the background drawing color used to half light button frame |
|
1320 |
" |
|
2219 | 1321 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1322 |
! |
1323 |
||
1324 |
buttonHalfShadowColor |
|
1325 |
"get the background drawing color used to half shadow button frame |
|
1326 |
" |
|
2219 | 1327 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1328 |
! |
1329 |
||
1330 |
buttonLightColor |
|
1331 |
"get the background drawing color used to light button frame |
|
1332 |
" |
|
2219 | 1333 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1334 |
! |
1335 |
||
1336 |
buttonPassiveBackgroundColor |
|
1337 |
"get the background drawing color used for button |
|
1338 |
" |
|
2219 | 1339 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1340 |
! |
1341 |
||
1342 |
buttonShadowColor |
|
1343 |
"get the background drawing color used to shadow button frame |
|
1344 |
" |
|
2219 | 1345 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1346 |
! |
1347 |
||
1348 |
disabledEtchedForegroundColor |
|
1349 |
"return the color used for etching disabled items. |
|
1350 |
If nil, no 3D effect is drawn. |
|
1351 |
" |
|
2219 | 1352 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1353 |
! |
1354 |
||
390 | 1355 |
disabledForegroundColor |
1356 |
"return the foreground color used by disabled items |
|
1357 |
" |
|
2219 | 1358 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1359 |
! |
1360 |
||
2170 | 1361 |
enteredBackgroundColor |
1362 |
"return the background color for entered items |
|
1363 |
" |
|
2219 | 1364 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
1365 |
default:(self backgroundColor) |
|
2170 | 1366 |
! |
1367 |
||
1368 |
enteredForegroundColor |
|
1369 |
"return the foreground color for entered items |
|
1370 |
" |
|
2219 | 1371 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1372 |
! |
1373 |
||
390 | 1374 |
font:aFont |
1375 |
"set the font |
|
1376 |
" |
|
829 | 1377 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
2219 | 1378 |
super font:(aFont "onDevice:device"). |
1379 |
||
1380 |
superMenu notNil ifTrue:[ |
|
1381 |
self extent:(self preferredExtent) |
|
1382 |
]. |
|
1383 |
self mustRearrange. |
|
390 | 1384 |
] |
1385 |
! |
|
1386 |
||
1387 |
foregroundColor |
|
1388 |
"return the passive foreground color |
|
1389 |
" |
|
2059 | 1390 |
^ fgColor |
390 | 1391 |
! |
1392 |
||
1393 |
foregroundColor:aColor |
|
1394 |
"set the foregroundColor drawing color. You should not use this method; |
|
1395 |
instead leave the value as defined in the styleSheet. |
|
1396 |
" |
|
2219 | 1397 |
aColor ~= fgColor ifTrue:[ |
1478 | 1398 |
fgColor := aColor onDevice:device. |
2219 | 1399 |
shown ifTrue:[ self invalidate ] |
1400 |
]. |
|
580 | 1401 |
! |
1402 |
||
1699 | 1403 |
maxAbsoluteButtonLevel |
1404 |
"returns the maximum absolute button level; used to compute the preferred |
|
1405 |
extent of a button |
|
1406 |
" |
|
2219 | 1407 |
^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' |
390 | 1408 |
! |
1409 |
||
730 | 1410 |
selectionFrameBrightColor |
1411 |
"get the selection frame bright color |
|
1412 |
" |
|
2219 | 1413 |
^ Color white |
730 | 1414 |
! |
1415 |
||
1416 |
selectionFrameDarkColor |
|
1417 |
"get the selection frame dark color |
|
1418 |
" |
|
2219 | 1419 |
^ Color black |
730 | 1420 |
! |
1421 |
||
1727 | 1422 |
setFont:aFont |
1423 |
"set the font derived from item; if unchanged nil is returned otherwise the old font |
|
1424 |
" |
|
1425 |
|currentFont| |
|
1426 |
||
1427 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
2219 | 1428 |
currentFont := font. |
1429 |
super font:aFont. |
|
1727 | 1430 |
]. |
1431 |
^ currentFont |
|
390 | 1432 |
! ! |
1433 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1434 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1435 |
|
1436 |
height |
|
1437 |
"default height |
|
1438 |
" |
|
1439 |
(explicitExtent ~~ true) ifTrue:[ |
|
2219 | 1440 |
^ self preferredExtent y |
388 | 1441 |
]. |
1442 |
^ super height |
|
1443 |
! |
|
1444 |
||
2016 | 1445 |
maxExtent |
1446 |
"CLAUS: returns the maximum extent |
|
1447 |
" |
|
1448 |
|x y| |
|
1449 |
||
1450 |
device isNil ifTrue:[ |
|
2219 | 1451 |
superMenu notNil ifTrue:[ |
1452 |
^ superMenu maxExtent |
|
1453 |
]. |
|
2016 | 1454 |
]. |
1455 |
y := device usableHeight - 2. |
|
1456 |
x := device usableWidth - 2. |
|
1457 |
^ x@y |
|
1458 |
! |
|
1459 |
||
388 | 1460 |
preferredExtent |
1461 |
"compute and returns my preferred extent |
|
2016 | 1462 |
" |
2253 | 1463 |
|maxExtent usedExtent| |
2024 | 1464 |
|
2016 | 1465 |
preferredExtent notNil ifTrue:[ |
2253 | 1466 |
^ preferredExtent |
2016 | 1467 |
]. |
2024 | 1468 |
maxExtent := self maxExtent. |
1469 |
usedExtent := self preferredExtentOfItems. |
|
1470 |
||
1471 |
superView isNil ifTrue:[ |
|
2253 | 1472 |
"/ is standalone |
1473 |
preferredWidth ifNotNil:[ |
|
1474 |
usedExtent x < preferredWidth ifTrue:[ |
|
1475 |
usedExtent := preferredWidth @ usedExtent y. |
|
1476 |
] |
|
1477 |
] |
|
2024 | 1478 |
]. |
1479 |
||
1480 |
^ usedExtent min:maxExtent |
|
1481 |
||
1482 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1483 |
! |
1484 |
||
1485 |
preferredExtentOfItems |
|
1486 |
"compute and returns my preferred extent including all items |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1487 |
!!!!!! changes have influence on method #rearrangeItems !!!!!! |
388 | 1488 |
" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1489 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1490 |
x "{ Class:SmallInteger }" |
1491 |
y "{ Class:SmallInteger }" |
|
1492 |
size "{ Class:SmallInteger }" |
|
2145 | 1493 |
buttonInsetX "{ Class:SmallInteger }" |
1494 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 1495 |
labelInsetX "{ Class:SmallInteger }" |
1496 |
labelInsetY "{ Class:SmallInteger }" |
|
1497 |
itemSpace "{ Class:SmallInteger }" |
|
1498 |
itemMargin "{ Class:SmallInteger }" |
|
1499 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1500 |
| |
388 | 1501 |
|
1699 | 1502 |
(size := items size) == 0 ifTrue:[ |
2219 | 1503 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
1504 |
^ 32 @ 32 |
|
1505 |
]. |
|
1506 |
buttonInsetX := 2 * self buttonInsetX. |
|
1507 |
buttonInsetY := 2 * self buttonInsetY. |
|
1699 | 1508 |
|
1509 |
self isPopUpView ifFalse:[ |
|
2219 | 1510 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1511 |
] ifTrue:[ |
2145 | 1512 |
labelInsetX := labelInsetY := 0. |
1699 | 1513 |
]. |
1514 |
||
1515 |
x := 0. |
|
1516 |
y := 0. |
|
2219 | 1517 |
groupDividerSize := self groupDividerSize. |
388 | 1518 |
|
1519 |
self verticalLayout ifFalse:[ |
|
2219 | 1520 |
itemSpace := self itemSpace. |
1521 |
||
1699 | 1522 |
items keysAndValuesDo:[:key :el| |eX eY| |
1523 |
extent := el preferredExtent. |
|
1524 |
||
1525 |
"/ check for visibility (extent x ~~ 0) |
|
1526 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1527 |
eY := extent y. |
|
1528 |
||
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1529 |
el isButton ifTrue:[ |
2145 | 1530 |
eX := eX + buttonInsetX. |
1531 |
eY := eY + buttonInsetY. |
|
1699 | 1532 |
] ifFalse:[ |
2145 | 1533 |
eX := eX + labelInsetX. |
1534 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1535 |
]. |
1699 | 1536 |
key ~~ size ifTrue:[ |
1537 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1538 |
x := x + groupDividerSize |
|
1539 |
] ifFalse:[ |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1540 |
el isLabeledItem ifTrue:[ |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1541 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1542 |
] |
1699 | 1543 |
] |
1544 |
]. |
|
1545 |
x := eX + x. |
|
1546 |
y := eY max:y. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1547 |
] |
1699 | 1548 |
] |
388 | 1549 |
] ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1550 |
hasMenu := false. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1551 |
shCtKey := 0. |
1699 | 1552 |
showAcc := MenuView showAcceleratorKeys == true. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1553 |
y := x. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1554 |
x := 0. |
2219 | 1555 |
itemMargin := 2 * self itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1556 |
|
1699 | 1557 |
items keysAndValuesDo:[:key :el| |eX eY| |
1558 |
extent := el preferredExtent. |
|
1559 |
||
1560 |
"/ check for visibility (extent x ~~ 0) |
|
1561 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1562 |
eY := extent y. |
|
1563 |
||
1564 |
el isButton ifTrue:[ |
|
2145 | 1565 |
eX := eX + buttonInsetX. |
1566 |
eY := eY + buttonInsetY. |
|
1699 | 1567 |
] ifFalse:[ |
2145 | 1568 |
eX := eX + labelInsetX. |
1569 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1570 |
]. |
1699 | 1571 |
hasMenu ifFalse:[ |
1572 |
hasMenu := el hasSubmenu |
|
1573 |
]. |
|
1574 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1575 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1576 |
]. |
|
1577 |
key ~~ size ifTrue:[ |
|
1578 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1579 |
y := y + groupDividerSize |
|
1580 |
] |
|
1581 |
]. |
|
1582 |
y := eY + y. |
|
1583 |
x := eX max:x. |
|
1584 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1585 |
]. |
2219 | 1586 |
x := x + itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1587 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1588 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1589 |
shortKeyInset := x + Item labelRightOffset. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1590 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1591 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1592 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
2219 | 1593 |
x := x + self shortcutKeyOffset. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1594 |
] |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1595 |
]. |
1699 | 1596 |
"/ to have a small inset |
1597 |
y := y + 1. |
|
1598 |
"/ x := x + 1. |
|
1599 |
]. |
|
1600 |
x := x + margin + margin. |
|
1601 |
y := y + margin + margin. |
|
1602 |
||
1603 |
^ x @ y |
|
388 | 1604 |
! |
1605 |
||
2253 | 1606 |
preferredWidth:aWidthOrNil |
1607 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1608 |
If nil (default), the width is computed from the contained items. |
|
1609 |
If not nil, the width is the maximum from the contained items and the required width. |
|
1610 |
" |
|
1611 |
preferredWidth := aWidthOrNil. |
|
2024 | 1612 |
! |
1613 |
||
388 | 1614 |
shortKeyInset |
1615 |
"left inset of shortcutKey |
|
1616 |
" |
|
1617 |
^ shortKeyInset |
|
616 | 1618 |
! |
1619 |
||
1620 |
subMenuIndicationWidth |
|
2219 | 1621 |
^ self rightArrow width |
388 | 1622 |
! ! |
1623 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1624 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1625 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1626 |
iconIndicationDisabledOff |
2219 | 1627 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1628 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1629 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1630 |
iconIndicationDisabledOn |
2219 | 1631 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1632 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1633 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1634 |
iconIndicationOff |
2219 | 1635 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1636 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1637 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1638 |
iconIndicationOn |
2219 | 1639 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1640 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1641 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1642 |
iconRadioGroupDisabledOff |
2219 | 1643 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1644 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1645 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1646 |
iconRadioGroupDisabledOn |
2219 | 1647 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1648 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1649 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1650 |
iconRadioGroupOff |
2219 | 1651 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1652 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1653 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1654 |
iconRadioGroupOn |
2219 | 1655 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1656 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1657 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1658 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1659 |
|
1660 |
itemAt:stringOrNumber do:aOneArgBlock |
|
1661 |
"evaluate teh block for an item and return the result from the block. In case that |
|
1662 |
the item not exists nil is returned |
|
1663 |
" |
|
1664 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
|
1665 |
! |
|
1666 |
||
1667 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1668 |
"evaluate teh block for an item and return the result from the block. In case that |
|
1669 |
the item not exists the result of the exception block is returned (no arguments). |
|
1670 |
" |
|
1671 |
|item| |
|
1672 |
||
1673 |
item := self itemAt:stringOrNumber. |
|
1674 |
item notNil ifTrue:[ ^ aOneArgBlock value:item ]. |
|
1675 |
^ exceptionBlock value |
|
706 | 1676 |
! |
1677 |
||
1678 |
itemAtIndex:anIndex |
|
1679 |
"returns item at an index or nil |
|
1680 |
" |
|
1681 |
^ 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
|
1682 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1683 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1684 |
items |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1685 |
"returns list of items or nil |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1686 |
" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1687 |
^ items |
388 | 1688 |
! ! |
1689 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1690 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1691 |
|
727 | 1692 |
buttonActiveLevel |
1693 |
"get the button active level |
|
1694 |
" |
|
2219 | 1695 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1696 |
! |
1697 |
||
1698 |
buttonPassiveLevel |
|
2219 | 1699 |
"get the button active level |
1700 |
" |
|
1701 |
^ styleSheet at:#'menuPanel.buttonPassiveLevel' |
|
727 | 1702 |
! |
1703 |
||
2337 | 1704 |
centerItems |
1705 |
^ centerItems ? false |
|
1706 |
! |
|
1707 |
||
1708 |
centerItems:aBoolean |
|
1709 |
centerItems := aBoolean |
|
1710 |
! |
|
1711 |
||
390 | 1712 |
fitFirstPanel |
1713 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1714 |
to the extent of its superView |
|
1699 | 1715 |
|
1716 |
NOT SUPPORTED |
|
388 | 1717 |
" |
2219 | 1718 |
^ false |
388 | 1719 |
! |
1720 |
||
390 | 1721 |
fitFirstPanel:aState |
1722 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1723 |
to the extent of its superView |
|
1699 | 1724 |
|
1725 |
NOT SUPPORTED |
|
1726 |
" |
|
616 | 1727 |
! |
1728 |
||
1093 | 1729 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1730 |
anInt ~~ level ifTrue:[ |
2219 | 1731 |
super level:anInt. |
1732 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1733 |
] |
2052 | 1734 |
|
1735 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1736 |
! |
1737 |
||
616 | 1738 |
rightArrow |
2219 | 1739 |
rightArrow ifNil:[ |
1740 |
device ifNil:[ |
|
1741 |
^ SelectionInListView rightArrowFormOn:Display |
|
1742 |
]. |
|
1743 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
1744 |
]. |
|
616 | 1745 |
^ rightArrow |
1746 |
! |
|
1747 |
||
1748 |
rightArrowShadow |
|
1749 |
^ rightArrowShadow |
|
388 | 1750 |
! |
1751 |
||
390 | 1752 |
showGroupDivider |
1753 |
"get the enabled flag for showing groupDiveders |
|
388 | 1754 |
" |
2253 | 1755 |
^ showGroupDivider |
388 | 1756 |
! |
1757 |
||
390 | 1758 |
showGroupDivider:aState |
1759 |
"set the enabled flag for showing groupDiveders |
|
388 | 1760 |
" |
2253 | 1761 |
showGroupDivider ~~ aState ifTrue:[ |
1762 |
showGroupDivider := aState. |
|
1763 |
self mustRearrange. |
|
653 | 1764 |
] |
388 | 1765 |
! |
1766 |
||
1767 |
showSeparatingLines |
|
1768 |
"gets true if drawing of separating lines is enabled. |
|
1769 |
" |
|
2253 | 1770 |
^ showSeparatingLines |
388 | 1771 |
! |
1772 |
||
390 | 1773 |
showSeparatingLines:aState |
388 | 1774 |
"turn on/off drawing of separating lines. |
1775 |
" |
|
2253 | 1776 |
aState ~~ showSeparatingLines ifTrue:[ |
1777 |
showSeparatingLines := aState. |
|
1778 |
self mustRearrange |
|
1779 |
]. |
|
388 | 1780 |
! |
1781 |
||
1782 |
verticalLayout |
|
1783 |
"get the layout: or vertical( true ) or horizontal( false ) |
|
1784 |
" |
|
2253 | 1785 |
verticalLayout ifNotNil:[ ^ verticalLayout ]. |
1786 |
||
1787 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
1788 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
|
1789 |
||
1790 |
^ verticalLayout |
|
388 | 1791 |
! |
1792 |
||
1793 |
verticalLayout:aState |
|
1794 |
"set the layout: or vertical( true ) or horizontal( false ) |
|
1795 |
" |
|
2253 | 1796 |
aState ~~ verticalLayout ifTrue:[ |
1797 |
verticalLayout isNil ifTrue:[ |
|
1798 |
verticalLayout := aState |
|
1799 |
] ifFalse:[ |
|
1800 |
verticalLayout := aState. |
|
1801 |
self mustRearrange. |
|
1802 |
]. |
|
1803 |
]. |
|
388 | 1804 |
! ! |
1805 |
||
2219 | 1806 |
!MenuPanel methodsFor:'accessing-style'! |
1807 |
||
1808 |
buttonInsetX |
|
1809 |
"returns the verical button space |
|
1810 |
" |
|
1811 |
^ styleSheet at:#'menuPanel.buttonInsetX' |
|
1812 |
! |
|
1813 |
||
1814 |
buttonInsetY |
|
1815 |
"returns the verical button space |
|
1816 |
" |
|
1817 |
^ styleSheet at:#'menuPanel.buttonInsetY' |
|
1818 |
! |
|
1819 |
||
1820 |
enteredLevel |
|
1821 |
"returns the enter-level for an unselected item moved through |
|
1822 |
" |
|
1823 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
|
1824 |
! |
|
1825 |
||
1826 |
groupDividerSize |
|
1827 |
"returns the width of a group divider |
|
1828 |
" |
|
1829 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
|
1830 |
! |
|
1831 |
||
1832 |
itemMargin |
|
1833 |
"returns the margin of an item |
|
1834 |
" |
|
1835 |
^ styleSheet at:#'menu.itemMargin' default:0 |
|
1836 |
! |
|
1837 |
||
1838 |
itemSpace |
|
1839 |
"returns the additional space for an item in a (vertical) panel |
|
1840 |
" |
|
1841 |
^ styleSheet at:#'menuPanel.itemSpace' |
|
1842 |
! |
|
1843 |
||
1844 |
selectionFollowsMouse |
|
1845 |
"returns true if the selection follows the mouse |
|
1846 |
" |
|
1847 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
|
1848 |
! |
|
1849 |
||
1850 |
shortcutKeyOffset |
|
1851 |
"returns the offset for a shortcutKey |
|
1852 |
" |
|
1853 |
^ 5 |
|
1854 |
! ! |
|
1855 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1856 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 1857 |
|
1858 |
subMenuAt:stringOrNumber |
|
1859 |
"gets the submenu of an item or nil |
|
1860 |
" |
|
1861 |
^ self itemAt:stringOrNumber do:[:el| el submenu ] |
|
1862 |
! |
|
1863 |
||
1864 |
subMenuAt:stringOrNumber put:aSubMenu |
|
1865 |
"sets the submenu of an item |
|
1866 |
" |
|
1867 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
|
1868 |
||
1869 |
! |
|
1870 |
||
1871 |
subMenuShown |
|
1872 |
"return the currently visible submenu - or nil if there is none |
|
1873 |
" |
|
1874 |
|item| |
|
1875 |
||
1876 |
(item := self selection) notNil ifTrue:[ |
|
2145 | 1877 |
^ item submenu |
388 | 1878 |
]. |
1879 |
^ nil |
|
1880 |
! ! |
|
1881 |
||
1698 | 1882 |
!MenuPanel methodsFor:'activation / deactivation'! |
388 | 1883 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1884 |
closeMenus |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1885 |
"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
|
1886 |
" |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1887 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1888 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1889 |
|
388 | 1890 |
hide |
1891 |
"hide the view, leave its modal event loop |
|
1892 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1893 |
|
388 | 1894 |
self selection:nil. |
1895 |
self unmap. |
|
1896 |
||
1897 |
||
1898 |
! |
|
1899 |
||
1900 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1901 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1902 |
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
|
1903 |
(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
|
1904 |
to some performer) |
388 | 1905 |
" |
1906 |
^ self showAt:(self origin) resizing:true |
|
1907 |
||
1908 |
! |
|
1909 |
||
1910 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1911 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1912 |
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
|
1913 |
(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
|
1914 |
to some performer) |
388 | 1915 |
" |
1916 |
^ self showAt:aPoint resizing:true |
|
1917 |
||
1918 |
||
1919 |
! |
|
1920 |
||
1921 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1922 |
"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
|
1923 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1924 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1925 |
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
|
1926 |
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
|
1927 |
if a non-nil is returned. |
388 | 1928 |
" |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1929 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1930 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 1931 |
|
1932 |
aBoolean ifTrue:[ |
|
2219 | 1933 |
self fixSize. |
388 | 1934 |
]. |
1935 |
self origin:aPoint. |
|
1459 | 1936 |
"/ self makeFullyVisible. -- done in realize |
388 | 1937 |
self openModal:[true]. "realize " |
1938 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1939 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1940 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1941 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1942 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
2219 | 1943 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1944 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1945 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1946 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1947 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1948 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 1949 |
! |
1950 |
||
1951 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1952 |
"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
|
1953 |
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
|
1954 |
(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
|
1955 |
to some performer) |
388 | 1956 |
" |
1957 |
^ self showAt:(device pointerPosition) resizing:true |
|
1958 |
||
1959 |
||
1960 |
! |
|
1961 |
||
1962 |
showCenteredIn:aView |
|
1963 |
"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
|
1964 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1965 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1966 |
to some performer) |
388 | 1967 |
" |
1968 |
|top| |
|
1969 |
||
1970 |
top := aView topView. |
|
1971 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1972 |
^ 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
|
1973 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1974 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 1975 |
! |
1976 |
||
1977 |
startUp |
|
1978 |
"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
|
1979 |
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
|
1980 |
(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
|
1981 |
to some performer) |
388 | 1982 |
" |
1983 |
^ self showAtPointer |
|
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1984 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1985 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1986 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1987 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1988 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1989 |
(unless the menu has already performed its action, by sending an appropriate message |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1990 |
to some performer) |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1991 |
" |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1992 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1993 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1994 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 1995 |
! |
1996 |
||
2332 | 1997 |
startUpFor:originatingWidget |
1998 |
"realize the menu at the current pointer position |
|
1999 |
return the value of the selectedItem or nil, of none was selected |
|
2000 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2001 |
to some performer) |
|
2002 |
" |
|
2003 |
originator := originatingWidget. |
|
2004 |
^ self startUp |
|
2005 |
! |
|
2006 |
||
1750 | 2007 |
startUpOrNil |
2008 |
"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
|
2009 |
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
|
2010 |
(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
|
2011 |
to some performer) |
1750 | 2012 |
" |
2013 |
^ self showAtPointer |
|
388 | 2014 |
! ! |
2015 |
||
2016 |
!MenuPanel methodsFor:'adding & removing'! |
|
2017 |
||
2018 |
createAtIndex:anIndexOrNil |
|
1800 | 2019 |
"create an item and add this item to the index. In case of nil, the item |
2020 |
is added to the end. If the index is not valid nil is returned; |
|
2021 |
otherwise the new created item is returned. |
|
388 | 2022 |
" |
2023 |
|max item| |
|
2024 |
||
2025 |
max := (items size) + 1. |
|
2026 |
||
2027 |
anIndexOrNil notNil ifTrue:[ |
|
2219 | 2028 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2029 |
^ nil |
|
2030 |
] |
|
388 | 2031 |
]. |
2032 |
items isNil ifTrue:[ |
|
2219 | 2033 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2034 |
] ifFalse:[ |
2219 | 2035 |
items := items asOrderedCollection |
388 | 2036 |
]. |
2037 |
item := Item in:self. |
|
2038 |
||
2039 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
2219 | 2040 |
items add:item |
388 | 2041 |
] ifFalse:[ |
2219 | 2042 |
items add:item beforeIndex:anIndexOrNil |
388 | 2043 |
]. |
2044 |
^ item |
|
2045 |
! |
|
2046 |
||
2047 |
remove:stringOrNumber |
|
2048 |
"remove the first item which is assigned to stringOrNumber; |
|
2049 |
if found, remove and return it |
|
2050 |
" |
|
2051 |
|item| |
|
2052 |
||
2053 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
2145 | 2054 |
items remove:item. |
2055 |
item destroy. |
|
2056 |
items isEmpty ifTrue:[items := nil]. |
|
2057 |
self mustRearrange. |
|
388 | 2058 |
]. |
2059 |
^ item |
|
2060 |
! |
|
2061 |
||
2062 |
removeAll |
|
2063 |
"remove all items and submenus |
|
2064 |
" |
|
2065 |
self disabledRedrawDo:[ |
|
2219 | 2066 |
self selection:nil. |
2067 |
groupSizes := nil. |
|
2068 |
items notNil ifTrue:[ |
|
2069 |
items copy do:[:el| el destroy ]. |
|
2070 |
]. |
|
2071 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2072 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2073 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2074 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2075 |
! ! |
2076 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2077 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2078 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2079 |
update:something with:aParameter from:changedObject |
498 | 2080 |
|
2081 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2082 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2083 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2084 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2085 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2086 |
|
388 | 2087 |
!MenuPanel methodsFor:'converting'! |
2088 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2089 |
asMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2090 |
"convert contents to menu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2091 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2092 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2093 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2094 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2095 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2096 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2097 |
^ menu |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2098 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2099 |
|
388 | 2100 |
fromSpec:aMenuSpec |
2101 |
"build from spec |
|
2102 |
" |
|
2103 |
|menu| |
|
2104 |
||
2105 |
menu := Menu new. |
|
2106 |
menu fromLiteralArrayEncoding:aMenuSpec. |
|
2107 |
self menu:menu |
|
2108 |
||
2109 |
! |
|
2110 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2111 |
menu:aMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2112 |
"convert to Menu |
388 | 2113 |
" |
2114 |
self disabledRedrawDo:[ |
|
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2115 |
|menu newItems menuReceiver| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2116 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2117 |
self removeAll. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2118 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2119 |
(menu := aMenu) notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2120 |
(aMenu isCollection) ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2121 |
menu := Menu new. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2122 |
menu fromLiteralArrayEncoding:aMenu. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2123 |
] ifFalse:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2124 |
menuReceiver := menu receiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2125 |
menuReceiver notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2126 |
receiver := menuReceiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2127 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2128 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2129 |
(newItems := menu menuItems) size > 0 ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2130 |
items := newItems collect:[:ni | |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2131 |
|i| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2132 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2133 |
i:= Item in:self. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2134 |
i menuItem:ni. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2135 |
i. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2136 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2137 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2138 |
self groupSizes:(menu groupSizes). |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2139 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2140 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2141 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2142 |
"Modified: / 8.8.1998 / 02:05:04 / cg" |
388 | 2143 |
! ! |
2144 |
||
2145 |
!MenuPanel methodsFor:'drawing'! |
|
2146 |
||
2147 |
disabledRedrawDo:aBlock |
|
2148 |
"evaluate a block without redrawing within the block; after processing |
|
2149 |
of the block a redraw might be performed |
|
2150 |
" |
|
2151 |
|state| |
|
2152 |
||
2153 |
state := mustRearrange. |
|
2154 |
mustRearrange := true. |
|
2155 |
aBlock value. |
|
2156 |
mustRearrange := state. |
|
2157 |
self mustRearrange |
|
2158 |
! |
|
2159 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2160 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2161 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2162 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2163 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2164 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2165 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2166 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2167 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2168 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2169 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2170 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2171 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2172 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2173 |
level:aLevel |
2219 | 2174 |
shadow:(self buttonShadowColor) |
2175 |
light:(self buttonLightColor) |
|
2176 |
halfShadow:(self buttonHalfShadowColor) |
|
2177 |
halfLight:(self buttonHalfLightColor) |
|
2178 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2179 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2180 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2181 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2182 |
|
2016 | 2183 |
drawItemsX:x y:y width:w height:h |
2184 |
"redraw items and groups in a damage |
|
2185 |
" |
|
2186 |
|isVertical item layout prevClip |
|
2187 |
x1 "{ Class:SmallInteger }" |
|
2188 |
x2 "{ Class:SmallInteger }" |
|
2189 |
y1 "{ Class:SmallInteger }" |
|
2190 |
y2 "{ Class:SmallInteger }" |
|
2191 |
start "{ Class:SmallInteger }" |
|
2192 |
stop "{ Class:SmallInteger }" |
|
2193 |
size "{ Class:SmallInteger }" |
|
2194 |
groupDivInset "{ Class:SmallInteger }" |
|
2195 |
| |
|
2196 |
||
2197 |
size := items size. |
|
2198 |
isVertical := self verticalLayout. |
|
2199 |
||
2200 |
isVertical ifTrue:[ |
|
2064 | 2201 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2016 | 2202 |
start == 0 ifTrue:[ ^ self ]. |
2203 |
y1 := y + h. |
|
2064 | 2204 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
2205 |
startingAt:(start + 1). |
|
2016 | 2206 |
] ifFalse:[ |
2064 | 2207 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2016 | 2208 |
start == 0 ifTrue:[ ^ self ]. |
2209 |
x1 := x + w. |
|
2064 | 2210 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
2211 |
startingAt:(start + 1). |
|
2016 | 2212 |
]. |
2213 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2214 |
||
2253 | 2215 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
2219 | 2216 |
groupDivInset := self groupDividerSize // 2. |
2016 | 2217 |
|
2218 |
groupDivInset ~~ 0 ifTrue:[ |
|
2219 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2220 |
start := start - 1 |
|
2221 |
] |
|
2222 |
]. |
|
2223 |
] ifFalse:[ |
|
2224 |
groupDivInset := 0 |
|
2225 |
]. |
|
2226 |
||
2227 |
prevClip := clipRect. |
|
2228 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2229 |
||
2230 |
start to:stop do:[:i| |
|
2231 |
item := items at:i. |
|
2232 |
item redraw. |
|
2233 |
||
2234 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2235 |
layout := item layout. |
|
2236 |
||
2237 |
isVertical ifTrue:[ |
|
2238 |
x1 := layout left. |
|
2239 |
x2 := layout right. |
|
2240 |
y1 := layout bottom + groupDivInset. |
|
2241 |
y2 := y1. |
|
2242 |
] ifFalse:[ |
|
2243 |
y1 := layout top. |
|
2244 |
y2 := layout bottom. |
|
2245 |
x1 := layout right + groupDivInset. |
|
2246 |
x2 := x1. |
|
2247 |
]. |
|
2248 |
self paint:shadowColor. |
|
2249 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2250 |
self paint:lightColor. |
|
2251 |
||
2252 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2253 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2254 |
||
2255 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2256 |
] |
|
2257 |
]. |
|
2258 |
self clippingRectangle:prevClip. |
|
2259 |
! |
|
2260 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2261 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2262 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2263 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2264 |
isSelected ifTrue:[ |
2219 | 2265 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2266 |
] ifFalse:[ |
2219 | 2267 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2268 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2269 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2270 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2271 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2272 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2273 |
|
1691 | 2274 |
self drawEdgesForX:(layout left) |
2275 |
y:(layout top) |
|
2276 |
width:(layout width) |
|
2277 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2278 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2279 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2280 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2281 |
|
2016 | 2282 |
drawScrollerAt:aDirection bounds:bounds |
2283 |
"draw a scroller |
|
2284 |
" |
|
2285 |
|scrolling icon level x y w h| |
|
2286 |
||
2287 |
x := bounds left. |
|
2288 |
y := bounds top. |
|
2289 |
w := bounds width. |
|
2290 |
h := bounds height. |
|
2291 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2292 |
scrolling := self scrollActivity. |
2016 | 2293 |
|
2294 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2219 | 2295 |
level := -2 |
2016 | 2296 |
] ifFalse:[ |
2219 | 2297 |
level := 1 |
2016 | 2298 |
]. |
2299 |
||
2300 |
level ~~ 0 ifTrue:[ |
|
2219 | 2301 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2302 |
]. |
2303 |
icon := scrolling iconAt:aDirection on:self. |
|
2304 |
||
2305 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2219 | 2306 |
y:(y + (h - icon height // 2)). |
2016 | 2307 |
! |
2308 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2309 |
invalidateItem:anItem repairNow:aBool |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2310 |
"an item changed; invalidate the items layout |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2311 |
" |
2016 | 2312 |
|layout| |
2313 |
||
2073
26c30a04413d
do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents:
2069
diff
changeset
|
2314 |
self sensor isNil ifTrue:[^ self]. |
26c30a04413d
do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents:
2069
diff
changeset
|
2315 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2316 |
(mustRearrange not and:[shown]) ifTrue:[ |
2219 | 2317 |
layout := anItem layout. |
2318 |
||
2319 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2320 |
self invalidate:(layout copy insetBy:-1) repairNow:aBool |
|
2321 |
] |
|
1728 | 2322 |
]. |
2323 |
||
2324 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2325 |
! |
2326 |
||
388 | 2327 |
mustRearrange |
910
5c9592e782fd
always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents:
898
diff
changeset
|
2328 |
"force rearrange (i.e. set the rearrange flag) |
388 | 2329 |
" |
2080 | 2330 |
mustRearrange ifFalse:[ |
2219 | 2331 |
mustRearrange := true. |
2332 |
shown ifTrue:[ |
|
2333 |
self invalidate "/ RepairNow:true |
|
2334 |
] |
|
388 | 2335 |
] |
590 | 2336 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2337 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2338 |
! |
2339 |
||
710 | 2340 |
rearrangeGroups |
1699 | 2341 |
"implements the groupIdentifier #right in a horizontal menu |
2342 |
" |
|
2343 |
|layout point |
|
710 | 2344 |
dltX "{ Class:SmallInteger }" |
2345 |
start "{ Class:SmallInteger }" |
|
2346 |
| |
|
2347 |
||
2348 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
2219 | 2349 |
^ self |
710 | 2350 |
]. |
2351 |
||
2352 |
layout := items last layout. |
|
2353 |
||
1699 | 2354 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2219 | 2355 |
^ self "/ no free space |
710 | 2356 |
]. |
2357 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2358 |
||
2359 |
start == 0 ifTrue:[ |
|
2219 | 2360 |
^ self "/ no item detected |
1699 | 2361 |
]. |
2362 |
point := dltX @ 0. |
|
2363 |
||
2364 |
"/ move items layout to right |
|
710 | 2365 |
|
2366 |
items from:start do:[:anItem| |
|
2219 | 2367 |
anItem isVisible ifTrue:[ |
2368 |
anItem layout moveBy:point. |
|
2369 |
] |
|
710 | 2370 |
]. |
2371 |
! |
|
2372 |
||
388 | 2373 |
rearrangeItems |
1699 | 2374 |
"recompute the layout of each item |
2016 | 2375 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!! |
1699 | 2376 |
" |
1791 | 2377 |
|isVertical extent isPopUpMenu |
2219 | 2378 |
x "{ Class:SmallInteger }" |
2379 |
y "{ Class:SmallInteger }" |
|
2380 |
x0 "{ Class:SmallInteger }" |
|
2381 |
y0 "{ Class:SmallInteger }" |
|
2382 |
x1 "{ Class:SmallInteger }" |
|
2383 |
y1 "{ Class:SmallInteger }" |
|
2384 |
size "{ Class:SmallInteger }" |
|
2385 |
insetX "{ Class:SmallInteger }" |
|
2386 |
insetY "{ Class:SmallInteger }" |
|
2387 |
labelInsetX "{ Class:SmallInteger }" |
|
2388 |
labelInsetY "{ Class:SmallInteger }" |
|
2145 | 2389 |
buttonInsetX "{ Class:SmallInteger }" |
2390 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 2391 |
itemMargin "{ Class:SmallInteger }" |
2392 |
itemSpace "{ Class:SmallInteger }" |
|
2393 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2394 |
| |
1699 | 2395 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2396 |
mustRearrange := false. |
390 | 2397 |
^ self |
2398 |
]. |
|
2219 | 2399 |
|
2080 | 2400 |
"/ DON'T SET THIS!! |
2401 |
"/ item layout: below of first item -> item invalidate |
|
2402 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2403 |
"/ -> invalidate:rapairDamage: |
|
2404 |
"/ -> redrawX:y:width:height: |
|
2405 |
"/ tries to get uninitialized layout from second item. |
|
2406 |
"/ This happens in a modal debugger!! |
|
2407 |
"/ mustRearrange := false. |
|
2219 | 2408 |
isVertical := self verticalLayout. |
2409 |
itemSpace := self itemSpace. |
|
2410 |
groupDividerSize := self groupDividerSize. |
|
2411 |
buttonInsetX := self buttonInsetX. |
|
2412 |
buttonInsetY := self buttonInsetY. |
|
2413 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2414 |
|
2415 |
isPopUpMenu ifFalse:[ |
|
2219 | 2416 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2417 |
] ifTrue:[ |
2145 | 2418 |
labelInsetX := labelInsetY := 0 |
388 | 2419 |
]. |
390 | 2420 |
|
2016 | 2421 |
(isPopUpMenu or:[explicitExtent ~~ true]) ifTrue:[ |savExt maxExt| |
2422 |
savExt := extent := self preferredExtent copy. |
|
1478 | 2423 |
|
1791 | 2424 |
isPopUpMenu ifFalse:[ |
1699 | 2425 |
isVertical ifTrue:[extent y:1.0] ifFalse:[extent x:1.0] |
2016 | 2426 |
] ifTrue:[ |
2427 |
savExt := extent copy. |
|
2428 |
maxExt := self maxExtent. |
|
2429 |
||
2430 |
isVertical ifTrue:[ |
|
2431 |
extent y:(extent y min:(maxExt y)) |
|
2432 |
] ifFalse:[ |
|
2433 |
extent x:(extent x min:(maxExt x)) |
|
2434 |
] |
|
1478 | 2435 |
]. |
2016 | 2436 |
self extent:extent. |
2437 |
extent := savExt. |
|
390 | 2438 |
] ifFalse:[ |
1699 | 2439 |
extent := self computeExtent |
390 | 2440 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2441 |
|
1093 | 2442 |
x := y := margin. |
2443 |
||
1699 | 2444 |
isVertical ifFalse:[ |
2445 |
y0 := margin. |
|
2446 |
y1 := extent y - margin. |
|
2447 |
||
2448 |
items keysAndValuesDo:[:anIndex :el| |
|
2449 |
el isVisible ifFalse:[ |
|
2450 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2451 |
] ifTrue:[ |
|
1478 | 2452 |
el isButton ifTrue:[ |
2145 | 2453 |
insetX := buttonInsetX. |
2454 |
insetY := buttonInsetY. |
|
2062 | 2455 |
] ifFalse:[ |
2145 | 2456 |
insetX := labelInsetX. |
2457 |
insetY := labelInsetY. |
|
1478 | 2458 |
]. |
2145 | 2459 |
x0 := x + insetX. |
2171 | 2460 |
x1 := x0 + (el preferredExtent x). |
2145 | 2461 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
2462 |
x := x1 + insetX. |
|
1699 | 2463 |
|
2464 |
size ~~ anIndex ifTrue:[ |
|
2465 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2466 |
x := x + groupDividerSize |
|
2467 |
] ifFalse:[ |
|
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2468 |
el isLabeledItem ifTrue:[ |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2469 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2470 |
] |
1699 | 2471 |
] |
2472 |
] |
|
1478 | 2473 |
]. |
1699 | 2474 |
]. |
2475 |
] ifTrue:[ |
|
2219 | 2476 |
itemMargin := self itemMargin. |
1699 | 2477 |
x0 := margin. |
2219 | 2478 |
x1 := extent x - margin - itemMargin. "/ -1 |
1699 | 2479 |
|
2480 |
items keysAndValuesDo:[:anIndex :el| |
|
2481 |
el isVisible ifFalse:[ |
|
2482 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2483 |
] ifTrue:[ |
|
2484 |
el isButton ifTrue:[ |
|
2145 | 2485 |
insetX := buttonInsetX. |
2486 |
insetY := buttonInsetY. |
|
1699 | 2487 |
] ifFalse:[ |
2145 | 2488 |
insetX := labelInsetX. |
2489 |
insetY := labelInsetY. |
|
1699 | 2490 |
]. |
2145 | 2491 |
y0 := y + insetY. |
1699 | 2492 |
y1 := y0 + el preferredExtent y. |
2219 | 2493 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
2145 | 2494 |
y := y1 + insetY. |
1699 | 2495 |
|
2496 |
size ~~ anIndex ifTrue:[ |
|
2497 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2498 |
y := y + groupDividerSize |
|
2499 |
] |
|
2500 |
] |
|
1478 | 2501 |
] |
2502 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2503 |
]. |
710 | 2504 |
self rearrangeGroups. |
2048 | 2505 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2506 |
mustRearrange := false. |
2048 | 2507 |
|
2508 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2509 |
! |
2510 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2511 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2512 |
"check for items which can change its visibility; |
2513 |
if at least one item exists, rearrange all items |
|
2514 |
" |
|
1464 | 2515 |
items isNil ifTrue:[^ self]. |
1699 | 2516 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2517 |
items do:[:item | |
2219 | 2518 |
item canChangeVisibility ifTrue:[ |
2519 |
mustRearrange := true. |
|
2520 |
self rearrangeItems. |
|
2521 |
^ self |
|
2522 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2523 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2524 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2525 |
|
388 | 2526 |
redrawX:x y:y width:w height:h |
2016 | 2527 |
"redraw a damage |
2528 |
" |
|
2052 | 2529 |
|y0 y1 x0 x1 bounds mustDrawPrevScroller mustDrawNextScroller| |
388 | 2530 |
|
710 | 2531 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2532 |
|
1699 | 2533 |
mustRearrange ifTrue:[ |
2534 |
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
|
2535 |
self rearrangeItems. |
1699 | 2536 |
^ self invalidate |
2537 |
]. |
|
2219 | 2538 |
self paint:(self viewBackground). |
1699 | 2539 |
self clearRectangleX:x y:y width:w height:h. |
2540 |
||
2016 | 2541 |
items size == 0 ifTrue:[ |
1699 | 2542 |
^ self |
2543 |
]. |
|
2016 | 2544 |
y0 := y. |
2545 |
y1 := y + h. |
|
2018 | 2546 |
x0 := x. |
2547 |
x1 := x + w. |
|
2016 | 2548 |
|
2549 |
self hasScrollers ifTrue:[ |
|
2550 |
(self hasScrollerAt:#PREV) ifTrue:[ |
|
2551 |
bounds := self scrollerBoundsAt:#PREV. |
|
2052 | 2552 |
mustDrawPrevScroller := false. |
2016 | 2553 |
|
2018 | 2554 |
self verticalLayout ifTrue:[ |
2555 |
bounds bottom > y ifTrue:[ |
|
2556 |
y0 := bounds bottom. |
|
2052 | 2557 |
mustDrawPrevScroller := true. |
2018 | 2558 |
]. |
2559 |
] ifFalse:[ |
|
2560 |
bounds right > x ifTrue:[ |
|
2561 |
x0 := bounds right. |
|
2052 | 2562 |
mustDrawPrevScroller := true. |
2018 | 2563 |
]. |
2052 | 2564 |
]. |
2565 |
mustDrawPrevScroller ifTrue:[ |
|
2566 |
self drawScrollerAt:#PREV bounds:bounds. |
|
2567 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2568 |
]. |
2016 | 2569 |
|
2570 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
|
2571 |
bounds := self scrollerBoundsAt:#NEXT. |
|
2052 | 2572 |
mustDrawNextScroller := false. |
2016 | 2573 |
|
2018 | 2574 |
self verticalLayout ifTrue:[ |
2575 |
bounds top < y1 ifTrue:[ |
|
2576 |
y1 := bounds top. |
|
2052 | 2577 |
mustDrawNextScroller := true. |
2018 | 2578 |
] |
2579 |
] ifFalse:[ |
|
2580 |
bounds left < x1 ifTrue:[ |
|
2581 |
x1 := bounds left. |
|
2052 | 2582 |
mustDrawNextScroller := true. |
2018 | 2583 |
] |
2052 | 2584 |
]. |
2585 |
mustDrawNextScroller ifTrue:[ |
|
2586 |
self drawScrollerAt:#NEXT bounds:bounds. |
|
2587 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2588 |
] |
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2589 |
]. |
2018 | 2590 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
2591 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
|
2016 | 2592 |
]. |
2052 | 2593 |
|
2594 |
"Modified: / 15.11.2001 / 20:57:32 / cg" |
|
388 | 2595 |
! ! |
2596 |
||
2597 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2598 |
||
2599 |
collect:aOneArgBlock |
|
2600 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2601 |
and return a collection of the results |
|
2602 |
" |
|
2603 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
|
2059 | 2604 |
^ nil |
388 | 2605 |
! |
2606 |
||
2607 |
do:aOneArgBlock |
|
2608 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel. |
|
2609 |
" |
|
2610 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
|
2611 |
||
2612 |
! |
|
2613 |
||
2614 |
findFirst:aOneArgBlock |
|
2615 |
"find the first item, for which evaluation of the argument, aOneArgBlock |
|
2616 |
returns true; return its index or 0 if none detected. |
|
2617 |
" |
|
2618 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
|
2619 |
^ 0 |
|
2620 |
||
2621 |
! |
|
2622 |
||
2623 |
findLast:aOneArgBlock |
|
2624 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2625 |
returns true; return its index or 0 if none detected. |
|
2626 |
" |
|
2627 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
|
2628 |
^ 0 |
|
2629 |
||
2630 |
! |
|
2631 |
||
390 | 2632 |
indexOf:something |
2633 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2634 |
If no item match 0 is returned. No range checks are performed on a number argument |
|
388 | 2635 |
" |
390 | 2636 |
|i v| |
2637 |
||
2638 |
something isNumber ifTrue:[ ^ something ]. |
|
2639 |
something isNil ifTrue:[ ^ 0 ]. |
|
2640 |
||
1218 | 2641 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2642 |
|
2643 |
i ~~ 0 ifTrue:[ |
|
2145 | 2644 |
^ i |
388 | 2645 |
]. |
390 | 2646 |
|
2647 |
something isSymbol ifTrue:[ |
|
2145 | 2648 |
i := self findFirst:[:el| |
2649 |
v := el value. |
|
2650 |
v isSymbol and:[v == something] |
|
2651 |
]. |
|
2652 |
i ~~ 0 ifTrue:[ |
|
2653 |
^ i |
|
2654 |
] |
|
390 | 2655 |
]. |
2656 |
||
2657 |
(something respondsTo:#string) ifTrue:[ |
|
2145 | 2658 |
v := something string. |
1218 | 2659 |
^ self findFirst:[:el | el textLabel = v]. |
2660 |
]. |
|
2661 |
^ 0 |
|
388 | 2662 |
! |
2663 |
||
706 | 2664 |
indexOfItem:anItem |
2665 |
"returns the index of the item or 0 |
|
2666 |
" |
|
2667 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
|
2668 |
! |
|
2669 |
||
388 | 2670 |
keysAndValuesDo:aTwoArgBlock |
2671 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel. |
|
2672 |
" |
|
2673 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
|
2674 |
||
2675 |
! ! |
|
2676 |
||
2677 |
!MenuPanel methodsFor:'event handling'! |
|
2678 |
||
2679 |
buttonMotion:state x:x y:y |
|
2680 |
"open or close the corresponding submenus |
|
2681 |
" |
|
2046 | 2682 |
|menue motionPoint translatedPoint sensor| |
1699 | 2683 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2684 |
self scrollActivity isActive ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2685 |
^ self |
2016 | 2686 |
]. |
2687 |
||
1699 | 2688 |
sensor := self sensor. |
2689 |
||
2690 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2691 |
^ self |
1699 | 2692 |
]. |
2693 |
menue := self detectGrabMenu. |
|
1841 | 2694 |
|
2046 | 2695 |
motionPoint := x@y. |
2696 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 2697 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 2698 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2699 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2700 |
|
1699 | 2701 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2702 |
^ self |
1699 | 2703 |
]. |
2704 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2705 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2706 |
"/ selection on grabView withou a submenu (Button ...); check whether moving out |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2707 |
(self containsPoint:motionPoint) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2708 |
^ self accept:nil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2709 |
] |
1699 | 2710 |
]. |
2711 |
||
2048 | 2712 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 2713 |
! |
2714 |
||
2715 |
buttonPress:button x:x y:y |
|
2716 |
"any button pressed; open or close the corresponding submenus |
|
2717 |
" |
|
2016 | 2718 |
|menu point| |
2719 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2720 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2721 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2722 |
self scrollActivity stop. |
2016 | 2723 |
point := x@y. |
2724 |
menu := self detectMenuAtGrabPoint:point. |
|
2725 |
||
2726 |
menu isNil ifTrue:[ |
|
2133
293dadf237ad
hide on buttonRelease outside (instead of buttonPress outside)
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
2727 |
"/ self accept:nil |
2016 | 2728 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2729 |
point := menu translateGrabPoint:point. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2730 |
menu handleButtonPressAtPoint:point. |
2016 | 2731 |
] |
2046 | 2732 |
|
2733 |
"Modified: / 13.11.2001 / 14:12:32 / cg" |
|
1699 | 2734 |
! |
2735 |
||
2736 |
buttonRelease:button x:x y:y |
|
2737 |
"button release action; accept selection and close all views |
|
2738 |
" |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2739 |
|topMenu dstMenu item srcPoint dstPoint subm doAction| |
2199 | 2740 |
|
2741 |
topMenu := self topMenu. |
|
2742 |
topMenu openDelayed:nil. |
|
1699 | 2743 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2744 |
self scrollActivity stop ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2745 |
^ self |
2016 | 2746 |
]. |
2747 |
||
1699 | 2748 |
dstMenu := topMenu activeMenu. |
2749 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2750 |
doAction := dstMenu selection notNil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2751 |
or:[dstMenu isPopUpView not]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2752 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2753 |
doAction ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2754 |
doAction := hideOnRelease. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2755 |
((OperatingSystem |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2756 |
millisecondTimeDeltaBetween:(Time millisecondClockValue) |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2757 |
and:(dstMenu mapTime)) |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2758 |
> (PopUpMenu maxClickTimeToStayOpen)) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2759 |
doAction := false |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2760 |
] |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2761 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2762 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2763 |
doAction ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2764 |
srcPoint := x@y. |
1699 | 2765 |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2766 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2767 |
and:[(item := dstMenu selection) notNil] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2768 |
) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2769 |
item visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2770 |
dstMenu selection:nil. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2771 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2772 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2773 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2774 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2775 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2776 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2777 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2778 |
subm := item currentSubmenu. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2779 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2780 |
subm ifNotNil:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2781 |
subm shown ifTrue:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2782 |
"/ test whether any action is assigned to the menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2783 |
"/ if not ignorre accept |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2784 |
item hasDelayedMenu ifFalse:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2785 |
"/ handle action defined for the delayed menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2786 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2787 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2788 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2789 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2790 |
item := nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2791 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2792 |
topMenu acceptItem:item inMenu:dstMenu. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2793 |
^ self |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2794 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2795 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2796 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2797 |
selection visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2798 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2799 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2800 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2801 |
self accept:nil. |
1699 | 2802 |
]. |
2803 |
! |
|
2804 |
||
2805 |
keyPress:key x:x y:y |
|
2806 |
"any key is pressed |
|
2807 |
" |
|
2251 | 2808 |
|menu superMenu sensor| |
2809 |
||
2810 |
sensor := self sensor. |
|
2811 |
sensor ifNil:[^ self]. |
|
2812 |
||
2813 |
sensor anyButtonPressed ifTrue:[ |
|
2814 |
^ self "/ ignorred while any button is pressed |
|
2815 |
]. |
|
1699 | 2816 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2817 |
self scrollActivity isActive ifTrue:[ |
2016 | 2818 |
key ~~ #Escape ifTrue:[ |
2819 |
^ self |
|
2820 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2821 |
self scrollActivity stop |
2016 | 2822 |
]. |
2823 |
||
1699 | 2824 |
(key == #Tab |
2825 |
or:[key == #FocusNext |
|
2826 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
2827 |
self accept:nil. |
|
2828 |
^ super keyPress:key x:x y:y |
|
2829 |
]. |
|
2830 |
||
2831 |
menu := self detectGrabMenu. |
|
2251 | 2832 |
superMenu := menu superMenu. |
1699 | 2833 |
|
2834 |
key == #Escape ifTrue:[ |
|
2835 |
"/ must hide the active menu |
|
2251 | 2836 |
(superMenu notNil and:[superMenu ~~ self]) ifTrue:[ |
1703 | 2837 |
"/ hide active menu but keep the grab |
2251 | 2838 |
superMenu selection:nil |
1699 | 2839 |
] ifFalse:[ |
1703 | 2840 |
"/ hide active menu and ungrab |
1699 | 2841 |
self accept:nil |
2251 | 2842 |
]. |
2843 |
^ self |
|
2844 |
]. |
|
2845 |
||
2846 |
menu isViewWrapper ifFalse:[ |
|
2847 |
sensor compressKeyPressEventsWithKey:key. |
|
2848 |
menu handleKeyPress:key. |
|
2849 |
^ self |
|
2850 |
]. |
|
2851 |
superMenu == self ifFalse:[^ self]. |
|
2852 |
||
2853 |
"/ allow cursor movement |
|
2854 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
2855 |
(self containsPoint:x@y) ifTrue:[ |
|
2856 |
self handleKeyPress:key. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2857 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2858 |
]. |
1699 | 2859 |
! |
2860 |
||
2861 |
pointerLeave:state |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2862 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2863 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2864 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 2865 |
|
1699 | 2866 |
self detectGrabMenu handlePointerLeave:state. |
2867 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2868 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
2251 | 2869 |
^ self |
2870 |
]. |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2871 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2872 |
selection visibleSubmenu ifNotNil:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2873 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2874 |
windowGroup focusView ~~ self ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2875 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2876 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2877 |
selection isButton ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2878 |
sensor := self sensor. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2879 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2880 |
sensor isNil ifTrue:[ |
2251 | 2881 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2882 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2883 |
"/ I'have the focus; if no button pressed, than keep the selection |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2884 |
sensor anyButtonPressed ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2885 |
self selection:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2886 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2887 |
]. |
2251 | 2888 |
] |
1699 | 2889 |
]. |
2890 |
! |
|
2891 |
||
2892 |
sizeChanged:how |
|
2893 |
"redraw #right groups |
|
2894 |
" |
|
2018 | 2895 |
self isPopUpView ifFalse:[ |
2219 | 2896 |
mustRearrange := true. |
2897 |
shown ifTrue:[ |
|
2898 |
self invalidate |
|
2899 |
] |
|
1699 | 2900 |
]. |
2901 |
super sizeChanged:how |
|
2902 |
! ! |
|
2903 |
||
2904 |
!MenuPanel methodsFor:'event handling processing'! |
|
2905 |
||
1767 | 2906 |
clearImplicitGrab |
2253 | 2907 |
implicitGrabView := lastPointerView := nil. |
1767 | 2908 |
! |
2909 |
||
2910 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2911 |
"dispatch and handle an event |
|
2912 |
" |
|
2253 | 2913 |
|view x y p syntheticEvent menu| |
1767 | 2914 |
|
2915 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
|
2916 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
2917 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
2918 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 2919 |
self sensor leftButtonPressed ifFalse:[ |
2920 |
self clearImplicitGrab. |
|
2921 |
]. |
|
1767 | 2922 |
]. |
2923 |
||
2924 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2253 | 2925 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 2926 |
]. |
2927 |
||
2928 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 2929 |
ev isButtonEvent ifTrue:[ |
2930 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
2931 |
ev view:implicitGrabView. |
|
2932 |
ev arguments at:2 put:p x. |
|
2933 |
ev arguments at:3 put:p y. |
|
2934 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2935 |
||
2936 |
ev isButtonReleaseEvent ifTrue:[ |
|
2937 |
self clearImplicitGrab. |
|
2938 |
]. |
|
2939 |
^ self |
|
2940 |
] |
|
1767 | 2941 |
]. |
2942 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
2943 |
||
2016 | 2944 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
2253 | 2945 |
self clearImplicitGrab. |
1767 | 2946 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
2947 |
]. |
|
2948 |
||
2949 |
p := menu translateGrabPoint:(x@y). |
|
2950 |
view := self detectViewAtX:(p x) y:(p y) in:menu. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
2951 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 2952 |
|
2953 |
ev isButtonPressEvent ifTrue:[ |
|
2253 | 2954 |
(view wantsFocusWithButtonPress) ifTrue:[ |
2955 |
view requestFocus. |
|
2956 |
]. |
|
2957 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
2958 |
implicitGrabView := view. |
|
2959 |
] |
|
2960 |
]. |
|
1767 | 2961 |
|
2962 |
ev isButtonMotionEvent ifTrue:[ |
|
2253 | 2963 |
lastPointerView ~~ view ifTrue:[ |
2964 |
"/ must generate enter/leave ... (sigh) |
|
2965 |
lastPointerView notNil ifTrue:[ |
|
2966 |
"/ XXX: should be fixed |
|
2967 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
2968 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
2969 |
]. |
|
2970 |
view notNil ifTrue:[ |
|
2971 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
2972 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
2973 |
]. |
|
2974 |
lastPointerView := view. |
|
2975 |
]. |
|
1767 | 2976 |
]. |
2977 |
||
2978 |
ev view:view. |
|
2979 |
ev x:p x. |
|
2980 |
ev y:p y. |
|
2981 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
2982 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
2983 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 2984 |
! |
2985 |
||
2048 | 2986 |
handleButtonMotion:state atPoint:motionPoint |
1699 | 2987 |
"open or close the corresponding submenus |
2988 |
" |
|
2251 | 2989 |
|menu item translatedPoint containsPoint| |
2990 |
||
2991 |
containsPoint := self containsPoint:motionPoint. |
|
2992 |
containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ] |
|
2993 |
ifFalse:[ item := nil ]. |
|
2994 |
||
2995 |
self pointerEntersItem:item. |
|
1699 | 2996 |
|
1910 | 2997 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
2251 | 2998 |
"/ only update pointerEnter |
2048 | 2999 |
^ self |
3000 |
]. |
|
3001 |
||
2251 | 3002 |
containsPoint ifTrue:[ |
3003 |
self selection:item openMenu:true. |
|
3004 |
^ self |
|
3005 |
]. |
|
3006 |
||
3007 |
menu := self superMenuAtPoint:motionPoint. |
|
3008 |
||
3009 |
menu ifNotNil:[ |
|
2046 | 3010 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2251 | 3011 |
menu handleButtonMotion:state atPoint:translatedPoint. |
3012 |
^ self |
|
3013 |
]. |
|
3014 |
self isPopUpView ifTrue:[ |
|
3015 |
self selection:nil |
|
3016 |
]. |
|
2046 | 3017 |
! |
3018 |
||
3019 |
handleButtonPressAtPoint:aPoint |
|
2016 | 3020 |
"a button pressed; open or close the corresponding submenus |
3021 |
" |
|
2251 | 3022 |
| item sensor direction wasSelected| |
2016 | 3023 |
|
2046 | 3024 |
item := self itemAtPoint:aPoint. |
2251 | 3025 |
item ifNil:[ |
3026 |
self selection:nil openMenu:false. |
|
3027 |
^ self |
|
3028 |
]. |
|
3029 |
||
3030 |
direction := self scrollerDirectionAtPoint:aPoint. |
|
3031 |
direction notNil ifTrue:[ |
|
3032 |
(self scrollActivity startIfRequiredAt:direction on:self) ifTrue:[ |
|
3033 |
self pointerEntersItem:nil. |
|
3034 |
^ self |
|
2238 | 3035 |
] |
2016 | 3036 |
]. |
2251 | 3037 |
|
3038 |
wasSelected := (selection == item). |
|
3039 |
wasSelected ifFalse:[ |
|
3040 |
self selection:item openMenu:true |
|
3041 |
]. |
|
2199 | 3042 |
item hasDelayedMenu ifTrue:[^ self]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3043 |
|
2238 | 3044 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
2251 | 3045 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3046 |
item toggleSubmenuVisibility |
|
3047 |
]. |
|
2238 | 3048 |
^ self |
3049 |
]. |
|
3050 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3051 |
^ self |
|
3052 |
]. |
|
3053 |
self invalidateItem:item repairNow:true. |
|
3054 |
self acceptItem:item inMenu:self. |
|
3055 |
||
3056 |
(sensor := self sensor) notNil ifTrue:[ |
|
3057 |
[sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ]. |
|
3058 |
sensor flushUserEvents. |
|
3059 |
]. |
|
3060 |
self selection:nil. |
|
2046 | 3061 |
|
3062 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3063 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3064 |
! |
3065 |
||
1699 | 3066 |
handleCursorKey:aKey |
388 | 3067 |
"handle a cursor key |
3068 |
" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3069 |
|next menu item isVrt backKey p1 p2 |
2354 | 3070 |
idx0 "{ Class:SmallInteger }" |
687 | 3071 |
idx "{ Class:SmallInteger }" |
1705 | 3072 |
size "{ Class:SmallInteger }" |
687 | 3073 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3074 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3075 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
2354 | 3076 |
^ self |
388 | 3077 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3078 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3079 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3080 |
|
2016 | 3081 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3082 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3083 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3084 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3085 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3086 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3087 |
^ superMenu handleCursorKey:aKey |
1699 | 3088 |
]. |
2016 | 3089 |
idx := 0. |
3090 |
||
3091 |
isVrt ifTrue:[ |
|
3092 |
"/ used because of vertical scrolling |
|
3093 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
2354 | 3094 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
2016 | 3095 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3096 |
] ifFalse:[ |
2016 | 3097 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3098 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3099 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3100 |
|
2354 | 3101 |
idx0 := idx. |
3102 |
size timesRepeat:[ |
|
3103 |
|el| |
|
3104 |
||
3105 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3106 |
||
3107 |
idx > size ifTrue:[ |
|
3108 |
idx := 0 "1" |
|
3109 |
] ifFalse:[ |
|
3110 |
idx < 0 ifTrue:[ |
|
3111 |
idx := size |
|
3112 |
] |
|
3113 |
]. |
|
3114 |
||
3115 |
idx == 0 ifTrue:[ |
|
3116 |
self selection:nil. |
|
3117 |
^ self |
|
3118 |
] ifFalse:[ |
|
3119 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3120 |
el canSelect ifTrue:[ |
|
3121 |
el hasDelayedMenu ifTrue:[ |
|
3122 |
"/ do not open menu |
|
3123 |
self selection:el openMenu:false |
|
3124 |
] ifFalse:[ |
|
3125 |
"/ open comes from style-sheet |
|
3126 |
self selection:el. |
|
3127 |
]. |
|
3128 |
^ self |
|
2249 | 3129 |
]. |
2354 | 3130 |
] |
3131 |
]. |
|
3132 |
idx == idx0 ifTrue:[ |
|
3133 |
^ self |
|
3134 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3135 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3136 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3137 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3138 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3139 |
superMenu notNil ifTrue:[ |
1791 | 3140 |
p1 := self translateGrabPoint:0. |
3141 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3142 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3143 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3144 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3145 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3146 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3147 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3148 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3149 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3150 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3151 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3152 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3153 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3154 |
backKey := #CursorUp. |
1699 | 3155 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3156 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3157 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3158 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3159 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3160 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3161 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3162 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3163 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3164 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3165 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3166 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3167 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3168 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3169 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3170 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3171 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3172 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3173 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3174 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3175 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3176 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3177 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
2249 | 3178 |
self selectionIndex:item |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3179 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3180 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3181 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3182 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3183 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3184 |
selection hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3185 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3186 |
selection toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3187 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3188 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3189 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3190 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3191 |
superMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3192 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3193 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3194 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3195 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3196 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3197 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3198 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3199 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3200 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3201 |
handleKeyPress:key |
1699 | 3202 |
"any key is pressed |
3203 |
" |
|
2219 | 3204 |
|item inMenu| |
1699 | 3205 |
|
3206 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3207 |
self handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3208 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3209 |
key isCharacter ifTrue:[ |
1862 | 3210 |
"/ selection notNil ifTrue:[ |
3211 |
"/ inMenu := self |
|
3212 |
"/ ] ifFalse:[ |
|
3213 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3214 |
"/ ]. |
|
3215 |
inMenu := self. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3216 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3217 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3218 |
inMenu selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3219 |
] |
1699 | 3220 |
] ifFalse:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3221 |
( key == #CursorDown or:[key == #CursorUp |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3222 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3223 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3224 |
self handleCursorKey:key |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3225 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3226 |
] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3227 |
] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3228 |
! |
1699 | 3229 |
|
3230 |
handlePointerLeave:state |
|
3231 |
self pointerEntersItem:nil. |
|
3232 |
super pointerLeave:state |
|
3233 |
! |
|
3234 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3235 |
handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3236 |
"any key is pressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3237 |
" |
2238 | 3238 |
|sensor subm item| |
3239 |
||
3240 |
(item := selection) isNil ifTrue:[ |
|
3241 |
superMenu notNil ifTrue:[ |
|
2249 | 3242 |
item := superMenu selection. |
3243 |
||
3244 |
item value notNil ifTrue:[ |
|
3245 |
"/ is a delayed menu |
|
3246 |
self accept:item |
|
3247 |
] ifFalse:[ |
|
3248 |
item toggleSubmenuVisibility |
|
3249 |
] |
|
2238 | 3250 |
] ifFalse:[ |
3251 |
self accept |
|
3252 |
]. |
|
3253 |
^ self |
|
1841 | 3254 |
]. |
3255 |
selection hasSubmenu ifTrue:[ |
|
2238 | 3256 |
selection hasDelayedMenu ifFalse:[ |
2249 | 3257 |
selection toggleSubmenuVisibility. |
3258 |
^ self |
|
2238 | 3259 |
]. |
3260 |
subm := selection currentSubmenu. |
|
3261 |
||
3262 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
2249 | 3263 |
selection toggleSubmenuVisibility. |
3264 |
^ self |
|
2238 | 3265 |
]. |
3266 |
self openDelayed:nil |
|
1841 | 3267 |
]. |
3268 |
self accept. |
|
3269 |
||
2238 | 3270 |
" test for toggle " |
3271 |
item isToggle ifTrue:[ |
|
3272 |
self selection:item. |
|
3273 |
] ifFalse:[ |
|
3274 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3275 |
^ self |
|
3276 |
] |
|
3277 |
]. |
|
1841 | 3278 |
|
3279 |
(sensor := self sensor) isNil ifTrue:[ |
|
2238 | 3280 |
^ self |
1841 | 3281 |
]. |
3282 |
||
3283 |
[ sensor flushKeyboardFor:nil. |
|
2238 | 3284 |
Delay waitForSeconds:0.1. |
3285 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3286 |
|
3287 |
] whileTrue. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3288 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3289 |
|
1699 | 3290 |
pointerEntersItem:anItemOrNil |
3291 |
"the pointer moves over an item or nil; restore the old item and |
|
3292 |
redraw the new item highlighted. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3293 |
" |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3294 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3295 |
|
1699 | 3296 |
( anItemOrNil notNil |
3297 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3298 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3299 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3300 |
anItemOrNil isButton ifTrue:[ |
2219 | 3301 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
3302 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3303 |
) ifTrue:[ |
1699 | 3304 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3305 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3306 |
] ifFalse:[ |
2219 | 3307 |
(self enteredLevel ~~ 0 |
3308 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3309 |
) ifTrue:[ |
|
1699 | 3310 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3311 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3312 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3313 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3314 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3315 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3316 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3317 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3318 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3319 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3320 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3321 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3322 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3323 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3324 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3325 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3326 |
]. |
388 | 3327 |
! ! |
3328 |
||
2251 | 3329 |
!MenuPanel methodsFor:'focus handling'! |
3330 |
||
3331 |
hasKeyboardFocus:aBoolean |
|
3332 |
"notification from the windowGroup that I got/lost the keyboard focus. |
|
3333 |
" |
|
3334 |
|focusView| |
|
3335 |
||
3336 |
self isPopUpView ifTrue:[ |
|
3337 |
"/ not visible for popup menus |
|
3338 |
^ super hasKeyboardFocus:aBoolean |
|
3339 |
]. |
|
3340 |
||
3341 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3342 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3343 |
focusView := windowGroup focusView. |
|
3344 |
||
3345 |
focusView == self ifFalse:[ |
|
3346 |
self selection:nil. |
|
3347 |
] |
|
3348 |
] |
|
3349 |
]. |
|
3350 |
super hasKeyboardFocus:aBoolean. |
|
3351 |
! ! |
|
3352 |
||
388 | 3353 |
!MenuPanel methodsFor:'grabbing'! |
3354 |
||
1699 | 3355 |
doGrab |
3356 |
relativeGrabOrigin := nil. |
|
3357 |
||
3358 |
superMenu notNil ifTrue:[ |
|
2219 | 3359 |
superMenu doGrab |
1699 | 3360 |
] ifFalse:[ |
2219 | 3361 |
hasImplicitGrap ~~ true ifTrue:[ |
3362 |
self grabMouseAndKeyboard. |
|
3363 |
hasImplicitGrap := true |
|
3364 |
] |
|
1699 | 3365 |
] |
3366 |
! |
|
3367 |
||
3368 |
doUngrab:forceDo |
|
3369 |
||
3370 |
relativeGrabOrigin := nil. |
|
1767 | 3371 |
self clearImplicitGrab. |
1699 | 3372 |
|
3373 |
superMenu notNil ifTrue:[ |
|
2219 | 3374 |
forceDo ifTrue:[ |
3375 |
superMenu doUngrab:true |
|
3376 |
]. |
|
3377 |
^ self |
|
1699 | 3378 |
]. |
3379 |
||
3380 |
hasImplicitGrap ~~ true ifTrue:[ |
|
2219 | 3381 |
^ self |
1699 | 3382 |
]. |
3383 |
||
3384 |
forceDo ifFalse:[ |
|
2219 | 3385 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
3386 |
^ self |
|
3387 |
]. |
|
1699 | 3388 |
]. |
3389 |
self ungrabMouseAndKeyboard. |
|
3390 |
self selection:nil. |
|
3391 |
hasImplicitGrap := nil. |
|
1703 | 3392 |
prevFocusView := nil. |
3393 |
||
1699 | 3394 |
! |
3395 |
||
1630 | 3396 |
grabKeyboard |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3397 |
"grap the keyboard; keep previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3398 |
" |
1630 | 3399 |
previousKeyboardGrab := device activeKeyboardGrab. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3400 |
^ super grabKeyboard |
1630 | 3401 |
|
3402 |
||
3403 |
! |
|
3404 |
||
388 | 3405 |
grabMouseAndKeyboard |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3406 |
"get exclusive access to pointer and keyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3407 |
" |
388 | 3408 |
|sensor| |
3409 |
||
3410 |
realized ifTrue:[ |
|
2219 | 3411 |
prevFocusView := self windowGroup focusView. |
3412 |
||
3413 |
sensor := self sensor. |
|
3414 |
device activePointerGrab ~~ self ifTrue:[ |
|
3415 |
sensor notNil ifTrue:[ |
|
3416 |
sensor flushMotionEventsFor:nil. |
|
3417 |
]. |
|
3418 |
||
3419 |
(self grabPointer) ifFalse:[ |
|
3420 |
Delay waitForSeconds:0.1. |
|
3421 |
(self grabPointer) ifFalse:[ |
|
3422 |
"give up" |
|
3423 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
|
3424 |
self unmap |
|
3425 |
] |
|
3426 |
] |
|
3427 |
]. |
|
3428 |
||
3429 |
device activeKeyboardGrab ~~ self ifTrue:[ |
|
3430 |
sensor notNil ifTrue:[ |
|
3431 |
device sync. |
|
3432 |
sensor flushKeyboardFor:nil |
|
3433 |
]. |
|
3434 |
self grabKeyboard. |
|
3435 |
] |
|
388 | 3436 |
] |
3437 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3438 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3439 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3440 |
! |
3441 |
||
1630 | 3442 |
grabPointerWithCursor:aCursorOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3443 |
"grap the pointer; keep previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3444 |
" |
1630 | 3445 |
previousPointerGrab := device activePointerGrab. |
1699 | 3446 |
hasImplicitGrap := true. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3447 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3448 |
|
3449 |
||
3450 |
! |
|
3451 |
||
3452 |
ungrabKeyboard |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3453 |
"ungrap the keyboard; restore previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3454 |
" |
1630 | 3455 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3456 |
|
1630 | 3457 |
previousKeyboardGrab notNil ifTrue:[ |
2219 | 3458 |
device grabKeyboardInView:previousKeyboardGrab. |
1630 | 3459 |
]. |
3460 |
||
3461 |
||
3462 |
! |
|
3463 |
||
388 | 3464 |
ungrabMouseAndKeyboard |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3465 |
"ungrab resources (mouse and keyboard) |
388 | 3466 |
" |
1630 | 3467 |
self ungrabPointer. |
3468 |
self ungrabKeyboard. |
|
3469 |
! |
|
3470 |
||
3471 |
ungrabPointer |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3472 |
"ungrap the pointer; restore previous grab |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3473 |
" |
1630 | 3474 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3475 |
|
1630 | 3476 |
previousPointerGrab notNil ifTrue:[ |
2219 | 3477 |
device grabPointerInView:previousPointerGrab. |
1630 | 3478 |
]. |
3479 |
||
3480 |
||
388 | 3481 |
! ! |
3482 |
||
1251 | 3483 |
!MenuPanel methodsFor:'help'! |
3484 |
||
2058 | 3485 |
flyByHelpTextAt:srcPoint |
3486 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
|
2063 | 3487 |
If there is a selection, that items helpText is used (ignoring the given point). |
2058 | 3488 |
" |
3489 |
|dstMenu dstPoint| |
|
3490 |
||
3491 |
dstMenu := self detectMenuAtGrabPoint:srcPoint. |
|
2063 | 3492 |
dstMenu isNil ifTrue:[^ nil]. |
2058 | 3493 |
|
3494 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3495 |
^ dstMenu flyByHelpTextForItem:(dstMenu itemAtPoint:dstPoint). |
2058 | 3496 |
! |
3497 |
||
3498 |
flyByHelpTextForItem:anItem |
|
3499 |
"returns the helpText for an item (empty if none) |
|
3500 |
" |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
3501 |
|key app text| |
2063 | 3502 |
|
3503 |
anItem isNil ifTrue:[^ nil]. |
|
3504 |
anItem isButton ifFalse:[^ nil]. |
|
3505 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3506 |
text := anItem flyByHelpText. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3507 |
text isNil ifTrue:[ |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3508 |
((key := anItem activeHelpKey) notNil |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3509 |
and:[(app := self application) notNil]) ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
3510 |
text := app flyByHelpTextForKey:key. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3511 |
"/ text notNil ifTrue:[ |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3512 |
"/ anItem flyByHelpText:text. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3513 |
"/ ] |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3514 |
]. |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
3515 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
3516 |
text isNil ifTrue:[ |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3517 |
text := anItem activeHelpKey. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3518 |
text isNil ifTrue:[ |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3519 |
text := anItem label. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3520 |
text isString ifFalse:[ |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3521 |
text := nil. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3522 |
] |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3523 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
3524 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
3525 |
^ text |
2058 | 3526 |
! |
3527 |
||
1251 | 3528 |
helpText |
1613 | 3529 |
"return the helpText for the currently selected item (empty if none) |
3530 |
" |
|
3531 |
^ self helpTextForItem:selection |
|
1251 | 3532 |
! |
3533 |
||
1699 | 3534 |
helpTextAt:srcPoint |
1252 | 3535 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
3536 |
If there is a selection, that items helpText is used (ignoreing the given point). |
|
3537 |
" |
|
1699 | 3538 |
|dstMenu dstPoint| |
3539 |
||
3540 |
dstMenu := self detectMenuAtGrabPoint:srcPoint. |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3541 |
dstMenu isNil ifTrue:[^ '']. |
1699 | 3542 |
|
3543 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3544 |
^ dstMenu helpTextForItem:(dstMenu itemAtPoint:dstPoint). |
1613 | 3545 |
! |
3546 |
||
3547 |
helpTextForItem:anItem |
|
3548 |
"returns the helpText for an item (empty if none) |
|
3549 |
" |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3550 |
|key text app| |
1613 | 3551 |
|
3552 |
anItem isNil ifTrue:[^ '']. |
|
3553 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3554 |
text := anItem activeHelpText. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3555 |
text isNil ifTrue:[ |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3556 |
((key := anItem activeHelpKey) notNil |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3557 |
and:[(app := self application) notNil]) ifTrue:[ |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3558 |
text := app helpTextForKey:key. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3559 |
"/ text notNil ifTrue:[ |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3560 |
"/ anItem activeHelpText:text. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3561 |
"/ ] |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3562 |
]. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3563 |
]. |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
3564 |
^ text |
1251 | 3565 |
! ! |
3566 |
||
794 | 3567 |
!MenuPanel methodsFor:'image registration'! |
3568 |
||
3569 |
imageOnDevice:anImage |
|
3570 |
"returns image registered on device |
|
3571 |
" |
|
3572 |
^ self class image:anImage onDevice:device |
|
3573 |
! |
|
3574 |
||
3575 |
lightenedImageOnDevice:anImage |
|
3576 |
"returns lightened image registered on device |
|
3577 |
" |
|
3578 |
^ self class lightenedImage:anImage onDevice:device |
|
3579 |
! ! |
|
3580 |
||
1688 | 3581 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 3582 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3583 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3584 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3585 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3586 |
|
388 | 3587 |
create |
616 | 3588 |
"create the shadow view for a none contained submenu |
388 | 3589 |
" |
3590 |
super create. |
|
3591 |
||
3592 |
self isPopUpView ifTrue:[ |
|
2219 | 3593 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
3594 |
shadowView isNil ifTrue:[ |
|
3595 |
shadowView := (ShadowView onDevice:device) for:self |
|
3596 |
] ifFalse:[ |
|
3597 |
self saveUnder:true. |
|
3598 |
]. |
|
3599 |
] |
|
388 | 3600 |
] ifFalse:[ |
2219 | 3601 |
explicitExtent == true ifTrue:[ |
3602 |
(self width) == (superView width) ifTrue:[ |
|
3603 |
self verticalLayout:false |
|
3604 |
] |
|
3605 |
] |
|
388 | 3606 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3607 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3608 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 3609 |
! |
3610 |
||
3611 |
destroy |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3612 |
"destroy items and shadowView; remove dependencies |
388 | 3613 |
" |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3614 |
self clearLastActiveMenu. |
2051 | 3615 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
3616 |
items := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3617 |
|
498 | 3618 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
3619 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3620 |
|
388 | 3621 |
super destroy. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3622 |
superMenu := nil. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3623 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3624 |
|
2051 | 3625 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3626 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3627 |
|
616 | 3628 |
fetchDeviceResources |
2219 | 3629 |
"fetch device colors, to avoid reallocation at redraw time |
3630 |
" |
|
3631 |
|style| |
|
3632 |
||
3633 |
superMenu ifNotNil:[ |
|
3634 |
styleSheet := superMenu styleSheet |
|
3635 |
]. |
|
616 | 3636 |
|
3637 |
super fetchDeviceResources. |
|
3638 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
3639 |
"/ 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
|
3640 |
"/ (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
|
3641 |
|
616 | 3642 |
superMenu isNil ifTrue:[ |
2219 | 3643 |
rightArrow ifNil:[ |
3644 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
|
2059 | 3645 |
]. |
2219 | 3646 |
fgColor := fgColor onDevice:device. |
3647 |
style := styleSheet name. |
|
3648 |
||
3649 |
(style ~~ #os2 and:[style ~~ #win95]) ifTrue:[ |
|
3650 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
|
3651 |
] ifFalse:[ |
|
3652 |
rightArrowShadow := nil |
|
3653 |
]. |
|
616 | 3654 |
] ifFalse:[ |
2219 | 3655 |
rightArrow := superMenu rightArrow. |
3656 |
rightArrowShadow := superMenu rightArrowShadow. |
|
3657 |
||
3658 |
self foregroundColor:(superMenu foregroundColor). |
|
3659 |
self font:(superMenu font). |
|
3660 |
self viewBackground:(superMenu viewBackground). |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3661 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3662 |
|
1829 | 3663 |
items notNil ifTrue:[ |
2219 | 3664 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 3665 |
]. |
3666 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3667 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 3668 |
! |
3669 |
||
580 | 3670 |
initStyle |
3671 |
"initialize style specific stuff" |
|
3672 |
||
3673 |
super initStyle. |
|
616 | 3674 |
|
2219 | 3675 |
viewBackground := styleSheet colorAt:#'menuPanel.backgroundColor'. |
3676 |
font := styleSheet fontAt:#'menu.font'. |
|
3677 |
fgColor := styleSheet colorAt:#'menuPanel.foregroundColor'. |
|
1923 | 3678 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3679 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3680 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3681 |
self updateLevelAndBorder. |
580 | 3682 |
! |
3683 |
||
388 | 3684 |
initialize |
3685 |
"set default configuration |
|
3686 |
" |
|
3687 |
super initialize. |
|
616 | 3688 |
|
1730
4936edfc2eee
must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
3689 |
self enableMotionEvents. |
498 | 3690 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3691 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3692 |
self originChangedFlag:false. |
2253 | 3693 |
explicitExtent := nil. |
3694 |
shortKeyInset := 0. |
|
3695 |
mustRearrange := false. |
|
3696 |
showSeparatingLines := false. |
|
3697 |
showGroupDivider := true. |
|
388 | 3698 |
! |
3699 |
||
1573 | 3700 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3701 |
"grab the pointer here, when visible (but not if control has already been lost). |
388 | 3702 |
If the grab fails, try again and unmap myself if that fails too. |
3703 |
" |
|
1791 | 3704 |
|loIndices loItems| |
388 | 3705 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3706 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3707 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3708 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3709 |
self becomesActiveMenu. |
1573 | 3710 |
super map. |
388 | 3711 |
|
1785 | 3712 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 3713 |
loItems := items ? #[]. |
3714 |
||
3715 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 3716 |
|
388 | 3717 |
self isPopUpView ifTrue:[ |
2219 | 3718 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3719 |
] ifFalse:[ |
2219 | 3720 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3721 |
]. |
1791 | 3722 |
loItems do:[:el| el updateIndicators ]. |
388 | 3723 |
|
1785 | 3724 |
loIndices size > 0 ifTrue:[ |
2219 | 3725 |
self redrawX:0 y:0 width:width height:height. |
3726 |
self openMenusFromItemIndices:loIndices. |
|
388 | 3727 |
]. |
3728 |
||
1177 | 3729 |
"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
|
3730 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 3731 |
! |
3732 |
||
3733 |
realize |
|
3734 |
"realize menu and shadowView |
|
3735 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3736 |
|
388 | 3737 |
self isPopUpView ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3738 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3739 |
shadowView must be realized before self" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3740 |
self hiddenOnRealize:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3741 |
super realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3742 |
self resize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3743 |
self makeFullyVisible. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3744 |
"/ self mustRearrange. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3745 |
shadowView notNil ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3746 |
shadowView realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3747 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3748 |
self raise. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3749 |
self map. |
736 | 3750 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3751 |
super realize. |
1767 | 3752 |
]. |
3753 |
self allSubViewsDo:[:aView| aView realize ]. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3754 |
hideOnRelease := defaultHideOnRelease. |
388 | 3755 |
! |
3756 |
||
3757 |
recreate |
|
1832 | 3758 |
"this is called after a snapin or a migration. |
3759 |
If the image was saved with an active menu, hide the menu |
|
388 | 3760 |
" |
1455 | 3761 |
selection := nil. |
388 | 3762 |
super recreate. |
3763 |
! |
|
3764 |
||
1130 | 3765 |
reinitStyle |
3766 |
"handle style change while being open (win32 only - for now)" |
|
3767 |
||
3768 |
super reinitStyle. |
|
3769 |
||
3770 |
self fetchDeviceResources. |
|
1811 | 3771 |
self mustRearrange. "/ care for changed font sizes etc. |
3772 |
||
3773 |
self do:[:anItem | |
|
3774 |
anItem reinitStyle |
|
3775 |
]. |
|
1130 | 3776 |
|
3777 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 3778 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 3779 |
! |
3780 |
||
1796
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3781 |
reinitialize |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3782 |
"reinit after a snapIn |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3783 |
" |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3784 |
|
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3785 |
super reinitialize. |
1811 | 3786 |
"/ self reinitStyle. |
3787 |
||
3788 |
"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
|
3789 |
! |
c9d801c011f7
recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents:
1795
diff
changeset
|
3790 |
|
388 | 3791 |
unmap |
1330 | 3792 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
3793 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 3794 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3795 |
self clearLastActiveMenu. |
1699 | 3796 |
self doUngrab:(superMenu isNil). |
3797 |
"/ self isPopUpView ifTrue:[ |
|
3798 |
"/ self doUngrab:(superMenu isNil) |
|
3799 |
"/ ]. |
|
3800 |
||
388 | 3801 |
super unmap. |
3802 |
shadowView notNil ifTrue:[shadowView unmap]. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3803 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3804 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3805 |
updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3806 |
"update level & border, when it is known if I am a popUpView" |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3807 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3808 |
|bw lvl| |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3809 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3810 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3811 |
bw := styleSheet at:#'popup.borderWidth' default:1. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3812 |
lvl := styleSheet at:#'popup.level' default:0. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3813 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3814 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
2219 | 3815 |
lvl := styleSheet at:#'menuPanel.level'. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3816 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3817 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3818 |
self level:lvl. |
388 | 3819 |
! ! |
3820 |
||
1878 | 3821 |
!MenuPanel methodsFor:'keyboard control'! |
3822 |
||
3823 |
mnemonicViewNext:aKeyEvent |
|
3824 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
3825 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
3826 |
return the topMenu otherwise nil. |
|
3827 |
" |
|
2112 | 3828 |
|menu uKey lKey list index| |
3829 |
||
3830 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 3831 |
shown ifFalse:[^ nil]. |
3832 |
||
3833 |
uKey := aKeyEvent rawKey last asUppercase. |
|
3834 |
lKey := uKey asLowercase. |
|
2112 | 3835 |
|
3836 |
selection notNil ifTrue:[ |
|
2219 | 3837 |
"first lookup the current grapMenu before starting in the topMenu |
3838 |
" |
|
3839 |
menu := self detectGrabMenu. |
|
3840 |
||
3841 |
[ menu ~~ self ] whileTrue:[ |
|
3842 |
index := menu selectionIndex. |
|
3843 |
list := menu selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey]] |
|
3844 |
maxDepth:10 from:(index + 1) to:99999. |
|
2112 | 3845 |
|
2219 | 3846 |
list size ~~ 0 ifTrue:[ |
3847 |
"/ has item which responds to the mnemonic |
|
3848 |
menu processCollectedIndices:list. |
|
3849 |
^ self |
|
3850 |
]. |
|
3851 |
menu := menu superMenu. |
|
3852 |
]. |
|
3853 |
index := self selectionIndex. |
|
3854 |
list := self selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey] ] |
|
3855 |
maxDepth:10 from:(1 + index) to:99999. |
|
2112 | 3856 |
] ifFalse:[ |
2219 | 3857 |
index := 99999. |
3858 |
list := nil. |
|
2112 | 3859 |
]. |
3860 |
||
3861 |
list ifNil:[ |
|
2219 | 3862 |
list := self selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey] ] |
3863 |
maxDepth:10 from:1 to:index. |
|
3864 |
||
3865 |
list isNil ifTrue:[ |
|
3866 |
"/ must clear existing selection |
|
3867 |
self selection:nil. |
|
3868 |
^ nil |
|
3869 |
] |
|
2112 | 3870 |
]. |
3871 |
||
3872 |
"/ has item which responds to the mnemonic |
|
3873 |
self processCollectedIndices:list. |
|
3874 |
^ self |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3875 |
! |
1878 | 3876 |
|
3877 |
openMenusFromItemIndices:anItemIndiceList |
|
3878 |
"open all menus derived from sequence of item indices |
|
3879 |
" |
|
3880 |
|item| |
|
3881 |
||
3882 |
anItemIndiceList size == 0 ifTrue:[ |
|
2249 | 3883 |
^ self |
1878 | 3884 |
]. |
3885 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
3886 |
||
3887 |
(item notNil and:[item enabled]) ifTrue:[ |
|
2249 | 3888 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
3889 |
self selection:item openMenu:true. |
|
3890 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3891 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3892 |
! |
1878 | 3893 |
|
3894 |
processCollectedIndices:indices |
|
3895 |
|menu item| |
|
3896 |
||
3897 |
indices size == 0 ifTrue:[ |
|
2219 | 3898 |
^ self |
1878 | 3899 |
]. |
3900 |
menu := self. |
|
3901 |
||
3902 |
[menu selectionIndex == indices first] whileTrue:[ |
|
2219 | 3903 |
( (item := menu selection) isNil "/ shouldn't happen |
3904 |
or:[(menu := item submenu) isNil] "/ no more indices; done |
|
3905 |
) ifTrue:[ |
|
3906 |
^ true |
|
3907 |
]. |
|
3908 |
indices removeFirst. |
|
3909 |
||
3910 |
indices isEmpty ifTrue:[ |
|
3911 |
menu selection:nil. |
|
3912 |
^ self |
|
3913 |
] |
|
1878 | 3914 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3915 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3916 |
! |
1878 | 3917 |
|
3918 |
processShortcut:aKeyEvent |
|
3919 |
"a shortcutKey event as forwarded from the keyboardProcessor - if there is the |
|
3920 |
shortcut-key defined process the shortcut and return true otherwise false. |
|
3921 |
" |
|
2219 | 3922 |
|menu rKey lKey list item| |
1878 | 3923 |
|
3924 |
superMenu notNil ifTrue:[ |
|
3925 |
^ superMenu processShortcut:aKeyEvent |
|
3926 |
]. |
|
3927 |
shown ifFalse:[^ false]. |
|
3928 |
||
3929 |
item := nil. |
|
3930 |
rKey := aKeyEvent rawKey. |
|
3931 |
lKey := aKeyEvent key. |
|
3932 |
menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu |
|
3933 |
||
3934 |
[true] whileTrue:[ |
|
3935 |
list := menu selectItemIndicesFor:[:el||skey| |
|
3936 |
item := el. |
|
3937 |
skey := el shortcutKey. |
|
3938 |
skey == rKey or:[skey == lKey] |
|
3939 |
] |
|
3940 |
maxDepth:10. |
|
3941 |
||
3942 |
list size ~~ 0 ifTrue:[ |
|
3943 |
"/ has item which responds to the shortcut |
|
3944 |
item hasSubmenu ifFalse:[ |
|
3945 |
menu accept:item |
|
3946 |
] ifTrue:[ |
|
3947 |
menu processCollectedIndices:list. |
|
3948 |
self windowGroup focusView:self. |
|
3949 |
]. |
|
3950 |
^ true |
|
3951 |
]. |
|
3952 |
||
3953 |
menu == self ifTrue:[ ^ false ]. |
|
3954 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3955 |
]. |
2219 | 3956 |
^ false "/ never reached |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3957 |
! |
1878 | 3958 |
|
3959 |
selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth |
|
3960 |
"returns the sequence of indices up to the item for which the block |
|
3961 |
returns true. The first entry is the topmenu, the last entry the |
|
3962 |
item for which the block returns true. |
|
3963 |
If no item is detected, nil is returned |
|
3964 |
" |
|
2112 | 3965 |
^ self selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:1 to:99999 |
3966 |
! |
|
3967 |
||
3968 |
selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:aStart to:aStop |
|
3969 |
"returns the sequence of indices up to the item for which the block |
|
3970 |
returns true. The first entry is the topmenu, the last entry the |
|
3971 |
item for which the block returns true. |
|
3972 |
If no item is detected, nil is returned |
|
3973 |
" |
|
3974 |
|start stop| |
|
3975 |
||
3976 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
3977 |
||
3978 |
start := aStart max:1. |
|
3979 |
stop := aStop min:(items size). |
|
3980 |
||
2199 | 3981 |
start to:stop do:[:i| |item menu seq isItem test| |
2219 | 3982 |
item := items at:i. |
3983 |
test := isItem := aOneArgBlock value:item. |
|
3984 |
||
3985 |
test ifFalse:[ |
|
3986 |
item hasSubmenu ifTrue:[ |
|
3987 |
test := item hasDelayedMenu not |
|
3988 |
] |
|
3989 |
]. |
|
3990 |
test ifTrue:[ |
|
3991 |
(item enabled and:[item isVisible]) ifTrue:[ |
|
3992 |
isItem ifTrue:[ ^ OrderedCollection with:i ]. |
|
3993 |
||
3994 |
"process submenu" |
|
3995 |
menu := item submenu. |
|
3996 |
||
3997 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
|
3998 |
seq := menu selectItemIndicesFor:aOneArgBlock maxDepth:(maxDepth - 1). |
|
3999 |
seq notNil ifTrue:[ |
|
4000 |
seq addFirst:i. |
|
4001 |
^ seq |
|
4002 |
] |
|
4003 |
] |
|
4004 |
] |
|
4005 |
]. |
|
1878 | 4006 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4007 |
^ nil |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4008 |
! ! |
1878 | 4009 |
|
388 | 4010 |
!MenuPanel methodsFor:'misc'! |
4011 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4012 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4013 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4014 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4015 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4016 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4017 |
|
388 | 4018 |
superMenu |
4019 |
"returns supermenu or nil |
|
4020 |
" |
|
4021 |
^ superMenu |
|
4022 |
||
4023 |
||
4024 |
! |
|
4025 |
||
4026 |
topMenu |
|
4027 |
"returns the topMenu; the one having no superMenu |
|
4028 |
" |
|
1791 | 4029 |
|menu smenu| |
4030 |
||
4031 |
menu := self. |
|
4032 |
||
4033 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
2219 | 4034 |
menu := smenu |
1791 | 4035 |
]. |
4036 |
^ menu |
|
388 | 4037 |
! ! |
4038 |
||
1825 | 4039 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4040 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4041 |
printString |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4042 |
"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
|
4043 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4044 |
|string label| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4045 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4046 |
string := 'Menu:'. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4047 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4048 |
self do:[:anItem| |
2145 | 4049 |
label := anItem label ? ''. |
4050 |
string := string ,' ', label printString. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4051 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4052 |
^ string |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4053 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4054 |
"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
|
4055 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4056 |
|
388 | 4057 |
!MenuPanel methodsFor:'private'! |
4058 |
||
434 | 4059 |
application |
1613 | 4060 |
"optimize access to retrive the application |
4061 |
" |
|
2253 | 4062 |
application ifNotNil:[^ application ]. |
434 | 4063 |
|
4064 |
superMenu notNil ifTrue:[ |
|
2253 | 4065 |
application := superMenu application. |
4066 |
^ application |
|
4067 |
]. |
|
4068 |
application := super application. |
|
4069 |
^ application |
|
1872 | 4070 |
! |
434 | 4071 |
|
1572 | 4072 |
detectItemForKey:aKey |
4073 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
4074 |
if no item is detected nil is returned. |
|
4075 |
" |
|
4076 |
|cIdx uKey lKey item| |
|
4077 |
||
1699 | 4078 |
items isNil ifTrue:[^ nil]. |
4079 |
||
1572 | 4080 |
cIdx := self selectionIndex. |
4081 |
uKey := aKey asUppercase. |
|
4082 |
lKey := aKey asLowercase. |
|
4083 |
||
1699 | 4084 |
items keysAndValuesDo:[:anIndex :anItem| |char label| |
2219 | 4085 |
( anIndex ~~ cIdx |
4086 |
and:[anItem canSelect |
|
4087 |
and:[(label := anItem textLabel) notNil |
|
4088 |
and:[label size ~~ 0]]] |
|
4089 |
) ifTrue:[ |
|
4090 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4091 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4092 |
^ anItem |
|
4093 |
] |
|
4094 |
] ifFalse:[ |
|
4095 |
char := label at:1. |
|
4096 |
||
4097 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4098 |
anIndex > cIdx ifTrue:[ |
|
4099 |
^ anItem |
|
4100 |
]. |
|
4101 |
item isNil ifTrue:[item := anItem] |
|
4102 |
] |
|
4103 |
] |
|
4104 |
] |
|
1572 | 4105 |
]. |
4106 |
^ item |
|
4107 |
! |
|
4108 |
||
390 | 4109 |
menuAdornmentAt:aSymbol |
388 | 4110 |
"returns a value derived from adornment |
4111 |
" |
|
2253 | 4112 |
adornment ifNil:[^ nil]. |
4113 |
^ adornment at:aSymbol ifAbsent:nil |
|
388 | 4114 |
! |
4115 |
||
390 | 4116 |
menuAdornmentAt:aSymbol put:something |
2253 | 4117 |
"sets a value for the specific menu |
4118 |
" |
|
4119 |
|oldValue| |
|
4120 |
||
653 | 4121 |
adornment isNil ifTrue:[ |
2253 | 4122 |
something ifNil:[^ self]. |
4123 |
adornment := IdentityDictionary new. |
|
4124 |
] ifFalse:[ |
|
4125 |
oldValue := adornment at:aSymbol ifAbsent:nil. |
|
4126 |
oldValue == something ifTrue:[^ self]. |
|
653 | 4127 |
]. |
4128 |
adornment at:aSymbol put:something. |
|
388 | 4129 |
! |
4130 |
||
4131 |
onEachPerform:aSelector withArgList:aList |
|
4132 |
"on each item perform selector with an argument derived from aList |
|
4133 |
" |
|
4134 |
aList isCollection ifTrue:[ |
|
2145 | 4135 |
items size >= aList size ifTrue:[ |
4136 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4137 |
(items at:anIndex) perform:aSelector with:anArg |
|
4138 |
] |
|
4139 |
] |
|
388 | 4140 |
] ifFalse:[ |
2145 | 4141 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4142 |
] |
4143 |
||
4144 |
||
4145 |
! |
|
4146 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4147 |
registerImageOnDevice:anImage |
2269 | 4148 |
|
4149 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4150 |
^ self class image:anImage onDevice:device |
|
4151 |
||
4152 |
"/ |image| |
|
4153 |
"/ |
|
4154 |
"/ (image := anImage) notNil ifTrue:[ |
|
4155 |
"/ image device ~~ device ifTrue:[ |
|
4156 |
"/ image := image copy. |
|
4157 |
"/ ]. |
|
4158 |
"/ image := image onDevice:device. |
|
4159 |
"/ image := image clearMaskedPixels. |
|
4160 |
"/ ]. |
|
4161 |
"/ ^ image |
|
2355 | 4162 |
! |
4163 |
||
4164 |
superMenu:aSuperMenu |
|
4165 |
"set my supermenu from which i'am activated |
|
4166 |
" |
|
4167 |
superMenu := aSuperMenu. |
|
4168 |
||
4169 |
superMenu ifNotNil:[ |
|
4170 |
styleSheet := superMenu styleSheet. |
|
4171 |
rightArrow := superMenu rightArrow. |
|
4172 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4173 |
]. |
|
388 | 4174 |
! ! |
4175 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4176 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4177 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4178 |
activeMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4179 |
"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
|
4180 |
" |
687 | 4181 |
^ lastActiveMenu ? self |
4182 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4183 |
"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
|
4184 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4185 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4186 |
activeMenu:aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4187 |
"set the current active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4188 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4189 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4190 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4191 |
"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
|
4192 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4193 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4194 |
becomesActiveMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4195 |
"submenu becomes the active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4196 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4197 |
mapTime := Time millisecondClockValue. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4198 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4199 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4200 |
"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
|
4201 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4202 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4203 |
clearLastActiveMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4204 |
"reset the current active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4205 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4206 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4207 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4208 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4209 |
|
2251 | 4210 |
"/ prevFocusView notNil ifTrue:[ |
4211 |
"/ self windowGroup focusView:prevFocusView. |
|
4212 |
"/ prevFocusView := nil. |
|
4213 |
"/ ]. |
|
4214 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4215 |
top activeMenu == self ifTrue:[ |
2251 | 4216 |
top activeMenu:nil |
687 | 4217 |
] |
4218 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4219 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4220 |
! |
4221 |
||
4222 |
mapTime |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4223 |
"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
|
4224 |
" |
687 | 4225 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4226 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4227 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
687 | 4228 |
! ! |
4229 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4230 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 4231 |
|
4232 |
hasScrollerAt:aDirection |
|
4233 |
"returns true if a visible scroller at a direction exists |
|
4234 |
" |
|
4235 |
|layout| |
|
4236 |
||
4237 |
self hasScrollers ifFalse:[ |
|
2219 | 4238 |
^ false |
2016 | 4239 |
]. |
4240 |
||
4241 |
aDirection == #PREV ifTrue:[ |
|
2219 | 4242 |
layout := items first layout. |
2016 | 4243 |
|
4244 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
2219 | 4245 |
ifFalse:[ layout left < margin] |
2016 | 4246 |
]. |
4247 |
layout := items last layout. |
|
4248 |
||
4249 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
2219 | 4250 |
ifFalse:[ layout right > (width - margin)] |
2016 | 4251 |
! |
4252 |
||
4253 |
hasScrollers |
|
4254 |
"returns true if scrollers are needed |
|
4255 |
" |
|
2018 | 4256 |
|maxExtent first last isVert| |
4257 |
||
4258 |
(mustRearrange or:[items size < 2]) ifTrue:[^ false]. |
|
4259 |
||
4260 |
isVert := self verticalLayout. |
|
4261 |
||
4262 |
superView notNil ifTrue:[ |
|
2219 | 4263 |
( (first := items first layout) isNil |
4264 |
or:[(last := items last layout) isNil] |
|
4265 |
) ifTrue:[ |
|
4266 |
^ false |
|
4267 |
]. |
|
4268 |
isVert ifTrue:[ |
|
4269 |
^ first top < 0 or:[last bottom > height] |
|
4270 |
]. |
|
4271 |
^ first left < 0 or:[last right > width] |
|
2018 | 4272 |
]. |
4273 |
maxExtent := self maxExtent. |
|
4274 |
||
4275 |
isVert ifTrue:[ |
|
2219 | 4276 |
^ (height < maxExtent y) not |
2018 | 4277 |
]. |
4278 |
^ (width < maxExtent x) not |
|
2016 | 4279 |
! |
4280 |
||
4281 |
indexOfItemAtScroller:aDirection |
|
4282 |
"returns the index of the item under the scroller or 0 |
|
4283 |
" |
|
4284 |
|bounds min max layout| |
|
4285 |
||
4286 |
bounds := self scrollerBoundsAt:aDirection. |
|
4287 |
||
4288 |
bounds isNil ifTrue:[ |
|
2219 | 4289 |
^ 0 |
2016 | 4290 |
]. |
4291 |
||
4292 |
self verticalLayout ifTrue:[ |
|
2219 | 4293 |
min := bounds top. |
4294 |
max := bounds bottom. |
|
4295 |
||
4296 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4297 |
anItem isVisible ifTrue:[ |
|
4298 |
layout := anItem layout. |
|
4299 |
||
4300 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4301 |
^ anIndex |
|
4302 |
]. |
|
4303 |
]. |
|
4304 |
]. |
|
2016 | 4305 |
] ifFalse:[ |
2219 | 4306 |
min := bounds left. |
4307 |
max := bounds right. |
|
4308 |
||
4309 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4310 |
anItem isVisible ifTrue:[ |
|
4311 |
layout := anItem layout. |
|
4312 |
||
4313 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4314 |
^ anIndex |
|
4315 |
]. |
|
4316 |
]. |
|
4317 |
] |
|
2016 | 4318 |
]. |
4319 |
^ 0 |
|
4320 |
! |
|
4321 |
||
4322 |
makeItemVisible:anItem |
|
4323 |
"make an item visible |
|
4324 |
" |
|
2018 | 4325 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4326 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4327 |
inv1 inv2| |
2018 | 4328 |
|
4329 |
( anItem notNil |
|
4330 |
and:[self hasScrollers |
|
4331 |
and:[(layout := anItem layout) notNil]] |
|
4332 |
) ifFalse:[ |
|
2219 | 4333 |
^ self |
2016 | 4334 |
]. |
2018 | 4335 |
index := self indexOfItem:anItem. |
2016 | 4336 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4337 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4338 |
||
2018 | 4339 |
isVertical := self verticalLayout. |
4340 |
||
4341 |
isVertical ifTrue:[ |
|
2219 | 4342 |
boundsMin := boundsPREV bottom. |
4343 |
boundsMax := boundsNEXT top. |
|
4344 |
layoutMin := layout top. |
|
4345 |
layoutMax := layout bottom. |
|
4346 |
windowSz := height. |
|
2018 | 4347 |
] ifFalse:[ |
2219 | 4348 |
boundsMin := boundsPREV right. |
4349 |
boundsMax := boundsNEXT left. |
|
4350 |
layoutMin := layout left. |
|
4351 |
layoutMax := layout right. |
|
4352 |
windowSz := width. |
|
2018 | 4353 |
]. |
4354 |
||
4355 |
||
4356 |
layoutMin < boundsMin ifTrue:[ |
|
2219 | 4357 |
layoutMin >= 0 ifTrue:[ |
4358 |
^ self |
|
4359 |
]. |
|
4360 |
"/ test whether is first visible item |
|
4361 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
|
4362 |
||
4363 |
index == 0 ifTrue:[ scr0 := margin ] |
|
4364 |
ifFalse:[ scr0 := boundsMin ]. |
|
4365 |
||
4366 |
delta := layoutMin negated + scr0. |
|
2016 | 4367 |
] ifFalse:[ |
2219 | 4368 |
layoutMax > boundsMax ifFalse:[ |
4369 |
^ self |
|
4370 |
]. |
|
4371 |
"/ test whether is last visible item |
|
4372 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
|
4373 |
||
4374 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
|
4375 |
ifFalse:[ scr0 := boundsMax ]. |
|
4376 |
||
4377 |
delta := scr0 - layoutMax. |
|
2018 | 4378 |
]. |
4379 |
delta == 0 ifTrue:[ ^ self ]. |
|
4380 |
||
2016 | 4381 |
doScroll := false. |
4382 |
||
4383 |
shown ifTrue:[ |
|
2219 | 4384 |
delta abs < (windowSz / 2) ifTrue:[ |
4385 |
doScroll := true. |
|
4386 |
self repairDamage |
|
4387 |
] |
|
2016 | 4388 |
]. |
2018 | 4389 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4390 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4391 |
|
4392 |
doScroll ifFalse:[ |
|
2219 | 4393 |
^ self invalidate |
2016 | 4394 |
]. |
4395 |
||
2018 | 4396 |
windowSz := windowSz - margin - margin. |
4397 |
||
4398 |
scr0 := boundsMin. |
|
4399 |
scr1 := scr0 + delta abs. |
|
4400 |
scrSz := boundsMax - scr1. |
|
4401 |
||
4402 |
delta < 0 ifTrue:[ |
|
2219 | 4403 |
isVertical ifTrue:[ |
4404 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
|
4405 |
width:windowSz height:scrSz async:false. |
|
4406 |
||
4407 |
scr1 := scr0 + scrSz. |
|
4408 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
|
4409 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
|
4410 |
] ifFalse:[ |
|
4411 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
|
4412 |
width:scrSz height:windowSz async:false. |
|
4413 |
||
4414 |
scr1 := scr0 + scrSz. |
|
4415 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
|
4416 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
|
4417 |
]. |
|
4418 |
inv1 := boundsPREV. |
|
2016 | 4419 |
] ifFalse:[ |
2219 | 4420 |
isVertical ifTrue:[ |
4421 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
|
4422 |
width:windowSz height:scrSz async:false. |
|
4423 |
||
4424 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
|
4425 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
|
4426 |
] ifFalse:[ |
|
4427 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
|
4428 |
width:scrSz height:windowSz async:false. |
|
4429 |
||
4430 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
|
4431 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
|
4432 |
]. |
|
4433 |
inv1 := boundsNEXT. |
|
2042 | 4434 |
]. |
4435 |
self invalidate:inv1. |
|
4436 |
self invalidate:inv2. |
|
2048 | 4437 |
|
4438 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 4439 |
! |
4440 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4441 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4442 |
"returns the one and only scrollActivity - data holder |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4443 |
for a menu and all contained submenus |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4444 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4445 |
superMenu notNil ifTrue:[ |
2219 | 4446 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4447 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4448 |
scrollActivity isNil ifTrue:[ |
2219 | 4449 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4450 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4451 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4452 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4453 |
|
2016 | 4454 |
scrollerBoundsAt:aDirection |
4455 |
"returns the bounds of the scroller at a direction or nil |
|
4456 |
" |
|
4457 |
|y x w h inset| |
|
4458 |
||
4459 |
self hasScrollers ifFalse:[ |
|
2219 | 4460 |
^ nil |
2016 | 4461 |
]. |
4462 |
inset := 0. |
|
4463 |
x := y := inset. |
|
4464 |
w := h := 15. |
|
4465 |
||
4466 |
self verticalLayout ifTrue:[ |
|
2219 | 4467 |
aDirection == #NEXT ifTrue:[ |
4468 |
y := height - h - inset. |
|
4469 |
]. |
|
4470 |
w := width - inset - inset. |
|
2016 | 4471 |
] ifFalse:[ |
2219 | 4472 |
aDirection == #NEXT ifTrue:[ |
4473 |
x := width - w - inset. |
|
4474 |
]. |
|
4475 |
h := height - inset - inset. |
|
2016 | 4476 |
]. |
4477 |
^ Rectangle left:x top:y width:w height:h |
|
4478 |
! |
|
4479 |
||
2046 | 4480 |
scrollerDirectionAtPoint:aPoint |
4481 |
"returns the scroller-direction at aPoint, or nil |
|
4482 |
" |
|
4483 |
self hasScrollers ifTrue:[ |
|
2219 | 4484 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
4485 |
( (bounds := self scrollerBoundsAt:aDirection) notNil |
|
4486 |
and:[bounds containsPoint:aPoint] |
|
4487 |
) ifTrue:[ |
|
4488 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
|
4489 |
] |
|
4490 |
] |
|
2046 | 4491 |
]. |
4492 |
^ nil |
|
4493 |
||
4494 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 4495 |
! ! |
4496 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4497 |
!MenuPanel methodsFor:'private-searching'! |
388 | 4498 |
|
1699 | 4499 |
detectGrabMenu |
4500 |
"returns the menu which is responsible for the grap; the last opened menu |
|
4501 |
" |
|
4502 |
|subMenu| |
|
4503 |
||
4504 |
selection notNil ifTrue:[ |
|
2219 | 4505 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
4506 |
^ subMenu detectGrabMenu |
|
4507 |
] |
|
1699 | 4508 |
]. |
4509 |
^ self |
|
4510 |
! |
|
4511 |
||
4512 |
detectMenuAtGrabPoint:aGrabPoint |
|
4513 |
"returns the menu which contains the grab-point |
|
4514 |
" |
|
4515 |
|dstMenu dstPoint firstMenu| |
|
4516 |
||
4517 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
4518 |
||
4519 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
2219 | 4520 |
firstMenu := self. |
1699 | 4521 |
]. |
4522 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4523 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
2219 | 4524 |
^ firstMenu |
1699 | 4525 |
]. |
4526 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 4527 |
^ dstMenu ? firstMenu |
1699 | 4528 |
! |
4529 |
||
1767 | 4530 |
detectViewAtX:x y:y in:aTopView |
1922 | 4531 |
"detect view at x@y |
4532 |
" |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4533 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4534 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4535 |
"/ cg: old code was (refactored to use common code) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4536 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4537 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4538 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4539 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4540 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4541 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4542 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4543 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4544 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4545 |
"/ p := device translatePoint:(x@y) from:(aTopView id) to:(v id). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4546 |
"/ ^ self detectViewAtX:p x y:p y in:v. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4547 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4548 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4549 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4550 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4551 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4552 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4553 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 4554 |
! |
4555 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4556 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4557 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4558 |
If no item match nil is returned. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4559 |
" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4560 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4561 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4562 |
stringOrNumberOrPoint isPoint ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4563 |
^ self itemAtPoint:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4564 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4565 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4566 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 4567 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4568 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4569 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4570 |
itemAtPoint:aPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4571 |
"returns the item at aPoint or nil if none detected |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4572 |
" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4573 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4574 |
|
1699 | 4575 |
items notNil ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4576 |
x := aPoint x. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4577 |
y := aPoint y. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4578 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
1699 | 4579 |
]. |
4580 |
^ nil |
|
388 | 4581 |
! |
4582 |
||
2048 | 4583 |
superMenuAtPoint:aPoint |
4584 |
"returns the superMenu which contains aPoint, or nil if none detected |
|
1699 | 4585 |
" |
4586 |
|grabPoint superMenu| |
|
4587 |
||
2048 | 4588 |
(self containsPoint:aPoint) ifTrue:[ |
2219 | 4589 |
^ self |
1699 | 4590 |
]. |
4591 |
||
2048 | 4592 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 4593 |
superMenu := self. |
4594 |
||
4595 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
2219 | 4596 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
4597 |
^ superMenu |
|
4598 |
] |
|
388 | 4599 |
]. |
4600 |
^ nil |
|
1699 | 4601 |
|
2048 | 4602 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 4603 |
! ! |
4604 |
||
4605 |
!MenuPanel methodsFor:'queries'! |
|
4606 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4607 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4608 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4609 |
aView notNil ifTrue:[ |
2219 | 4610 |
"/ I am no longer a popUpView |
4611 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4612 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4613 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4614 |
|
388 | 4615 |
containsPoint:aPoint |
4616 |
"returns true if point is contained by the view |
|
4617 |
" |
|
4618 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
|
4619 |
! |
|
4620 |
||
4621 |
containsPointX:x y:y |
|
4622 |
"returns true if point is contained by the view |
|
4623 |
" |
|
708 | 4624 |
^ (x between:0 and:width) and:[y between:0 and:height] |
879 | 4625 |
|
388 | 4626 |
! |
4627 |
||
390 | 4628 |
hasGroupDividerAt:anIndex |
388 | 4629 |
"returns true if a divider is defined at an index |
4630 |
" |
|
4631 |
|i| |
|
4632 |
||
4633 |
groupSizes size ~~ 0 ifTrue:[ |
|
2219 | 4634 |
i := 0. |
4635 |
||
4636 |
groupSizes do:[:t| |
|
4637 |
(i := i + t) == anIndex ifTrue:[ |
|
4638 |
^ true |
|
4639 |
] |
|
4640 |
] |
|
388 | 4641 |
]. |
4642 |
^ false |
|
4643 |
||
4644 |
! |
|
4645 |
||
390 | 4646 |
hasGroupDividers |
4647 |
"returns true if any group divider exists |
|
4648 |
" |
|
4649 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
4650 |
! |
|
4651 |
||
388 | 4652 |
isEnabled |
4653 |
"returns enabled state of menu and items |
|
4654 |
" |
|
4655 |
^ self enabled |
|
4656 |
! |
|
4657 |
||
390 | 4658 |
isFitPanel |
4659 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 4660 |
be fit to the extent of its superView; |
4661 |
NOT SUPPORTED |
|
4662 |
" |
|
4663 |
^ false |
|
390 | 4664 |
! |
4665 |
||
388 | 4666 |
isPopUpView |
4667 |
"return true if view is a popup view; without decoration |
|
4668 |
and popUp to top immediately |
|
4669 |
" |
|
4670 |
^ superView isNil |
|
4671 |
||
4672 |
||
4673 |
! |
|
4674 |
||
4675 |
isVerticalLayout |
|
4676 |
"returns true if vertical layout otherwise false( horizontal layout ) |
|
4677 |
" |
|
1699 | 4678 |
^ self verticalLayout |
388 | 4679 |
|
4680 |
||
416 | 4681 |
! |
4682 |
||
1793 | 4683 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
4684 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 4685 |
! |
4686 |
||
416 | 4687 |
type |
428 | 4688 |
^ nil. |
416 | 4689 |
|
388 | 4690 |
! ! |
4691 |
||
4692 |
!MenuPanel methodsFor:'selection'! |
|
4693 |
||
4694 |
hasSelection |
|
4695 |
"returns true if a selection exists |
|
4696 |
" |
|
4697 |
^ self selection notNil |
|
4698 |
! |
|
4699 |
||
2199 | 4700 |
openDelayed:anItem |
4701 |
||
4702 |
superMenu ifNotNil:[ |
|
2219 | 4703 |
superMenu openDelayed:anItem. |
4704 |
^ self |
|
4705 |
]. |
|
2253 | 4706 |
openDelayedMenuBlock ifNotNil:[ |
4707 |
Processor removeTimedBlock:openDelayedMenuBlock. |
|
4708 |
openDelayedMenuBlock := nil. |
|
4709 |
]. |
|
4710 |
anItem ifNil:[ |
|
4711 |
openDelayedMenuBlock := nil. |
|
4712 |
^ self |
|
4713 |
]. |
|
4714 |
openDelayedMenuBlock := [ |
|
4715 |
openDelayedMenuBlock := nil. |
|
4716 |
anItem openDelayedSubmenu |
|
4717 |
]. |
|
4718 |
||
4719 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:0.5. |
|
2199 | 4720 |
! |
4721 |
||
388 | 4722 |
selection |
4723 |
"returns current selected item or nil |
|
4724 |
" |
|
4725 |
^ selection |
|
4726 |
||
4727 |
||
4728 |
! |
|
4729 |
||
4730 |
selection:anItemOrNil |
|
2016 | 4731 |
"change selection to an item or nil |
2249 | 4732 |
if the item has a submenu the first item might be selected (style-sheet) |
4733 |
" |
|
4734 |
|openMenu openOnSelect submenu item| |
|
4735 |
||
4736 |
selection == anItemOrNil ifTrue:[^ self]. |
|
4737 |
||
4738 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
4739 |
self selection:anItemOrNil openMenu:false. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4740 |
^ self |
2249 | 4741 |
]. |
4742 |
||
4743 |
openMenu := self isPopUpView not. |
|
4744 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
4745 |
||
4746 |
openMenu ifFalse:[ |
|
4747 |
openMenu := openOnSelect. |
|
4748 |
]. |
|
4749 |
self selection:anItemOrNil openMenu:openMenu. |
|
4750 |
||
4751 |
openOnSelect ifFalse:[ |
|
4752 |
"/ select first item in submenu |
|
4753 |
||
4754 |
submenu := anItemOrNil currentSubmenu. |
|
4755 |
||
4756 |
submenu ifNotNil:[ |
|
4757 |
item := submenu itemAt:1. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4758 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
2249 | 4759 |
submenu selection:item openMenu:false |
4760 |
] |
|
4761 |
]. |
|
4762 |
]. |
|
4763 |
! |
|
4764 |
||
4765 |
selection:anItemOrNil openMenu:openMenu |
|
4766 |
"change selection to an item or nil |
|
4767 |
" |
|
2251 | 4768 |
|helpListener oldSelect| |
2249 | 4769 |
|
4770 |
anItemOrNil == selection ifTrue:[ |
|
4771 |
^ self |
|
2016 | 4772 |
]. |
2199 | 4773 |
self openDelayed:nil. |
388 | 4774 |
|
2251 | 4775 |
oldSelect := selection. |
4776 |
selection := nil. |
|
2249 | 4777 |
|
4778 |
anItemOrNil ifNotNil:[ |
|
4779 |
self makeItemVisible:anItemOrNil. |
|
4780 |
anItemOrNil canSelect ifTrue:[ |
|
2251 | 4781 |
selection := anItemOrNil |
2249 | 4782 |
] ifFalse:[ |
2251 | 4783 |
oldSelect ifNil:[^ self]. |
2249 | 4784 |
]. |
4785 |
]. |
|
2251 | 4786 |
oldSelect ifNotNil:[ |
2249 | 4787 |
"/ clear current selection |
2251 | 4788 |
oldSelect isSelected:false. |
4789 |
]. |
|
4790 |
selection ifNil:[^ self]. |
|
4791 |
||
4792 |
selection == enteredItem ifTrue:[ |
|
2249 | 4793 |
enteredItem := nil |
2016 | 4794 |
] ifFalse:[ |
2249 | 4795 |
self pointerEntersItem:nil |
2016 | 4796 |
]. |
4797 |
ActiveHelp isActive ifTrue:[ |
|
2251 | 4798 |
helpListener := ActiveHelp currentHelpListener. |
4799 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 4800 |
]. |
4801 |
shown ifTrue:[ |
|
4802 |
self rearrangeItems. |
|
4803 |
||
4804 |
openMenu ifFalse:[ |
|
4805 |
selection invalidate. |
|
4806 |
] |
|
4807 |
]. |
|
4808 |
openMenu ifTrue:[ |
|
4809 |
selection isSelected:true. |
|
4810 |
]. |
|
388 | 4811 |
! |
4812 |
||
4813 |
selectionIndex |
|
4814 |
"returns index of current selection or 0 |
|
4815 |
" |
|
4816 |
|item| |
|
4817 |
||
4818 |
(item := self selection) notNil ifTrue:[ |
|
2145 | 4819 |
^ self findFirst:[:el| el == item ] |
388 | 4820 |
]. |
4821 |
^ 0 |
|
4822 |
||
4823 |
! |
|
4824 |
||
4825 |
selectionIndex:anIndex |
|
4826 |
"set selection at an index |
|
4827 |
" |
|
4828 |
self selection:(self itemAt:anIndex) |
|
4829 |
! ! |
|
4830 |
||
1791 | 4831 |
!MenuPanel methodsFor:'translation'! |
4832 |
||
4833 |
translateGrabPoint:aGrabPoint |
|
4834 |
"translate the grab point into self |
|
4835 |
" |
|
4836 |
superMenu isNil ifTrue:[ |
|
2219 | 4837 |
"I am the grapView" |
4838 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
1791 | 4839 |
^ aGrabPoint |
4840 |
]. |
|
4841 |
||
4842 |
relativeGrabOrigin isNil ifTrue:[ |
|
2219 | 4843 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
1791 | 4844 |
]. |
4845 |
^ relativeGrabOrigin + aGrabPoint |
|
4846 |
||
4847 |
! |
|
4848 |
||
4849 |
translateMenuPoint:aPoint toMenu:aMenu |
|
4850 |
"translate a point into another menu its point |
|
4851 |
" |
|
4852 |
|grapPoint| |
|
4853 |
||
4854 |
aMenu == self ifTrue:[ |
|
2219 | 4855 |
^ aPoint |
1791 | 4856 |
]. |
4857 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
4858 |
||
4859 |
^ aMenu translateGrabPoint:grapPoint |
|
4860 |
||
4861 |
! |
|
4862 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4863 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4864 |
"translate a point in my window to anotherWindowOrNilForScreen (or root window if nil) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4865 |
" |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4866 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4867 |
^ device |
2219 | 4868 |
translatePoint:aPoint asPoint |
4869 |
fromView:self |
|
4870 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4871 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4872 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 4873 |
! ! |
4874 |
||
388 | 4875 |
!MenuPanel::Item class methodsFor:'accessing'! |
4876 |
||
689 | 4877 |
horizontalInset |
4878 |
^ HorizontalInset |
|
4879 |
! |
|
4880 |
||
388 | 4881 |
labelRightOffset |
4882 |
^ LabelRightOffset |
|
4883 |
! |
|
4884 |
||
689 | 4885 |
verticalInset |
4886 |
^ VerticalInset |
|
1765 | 4887 |
! |
4888 |
||
4889 |
verticalPopUpInset |
|
4890 |
^ VerticalPopUpInset |
|
388 | 4891 |
! ! |
4892 |
||
616 | 4893 |
!MenuPanel::Item class methodsFor:'defaults'! |
4894 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4895 |
halfSeparatorSize |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4896 |
"returns size of a space-separator |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4897 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4898 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4899 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4900 |
|
1699 | 4901 |
separatorSize |
616 | 4902 |
"returns size of a separator |
4903 |
" |
|
1699 | 4904 |
^ 10 |
616 | 4905 |
! |
4906 |
||
4907 |
updateStyleCache |
|
388 | 4908 |
"setup defaults |
650 | 4909 |
self updateStyleCache |
388 | 4910 |
" |
1765 | 4911 |
<resource: #style (#'menuPanel.verticalInset')> |
4912 |
||
1699 | 4913 |
HorizontalInset := 2. |
1765 | 4914 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
4915 |
VerticalPopUpInset := 2. |
|
727 | 4916 |
|
4917 |
HorizontalButtonInset := 3. |
|
4918 |
VerticalButtonInset := 3. |
|
4919 |
||
681 | 4920 |
LabelRightOffset := 15. |
1765 | 4921 |
|
4922 |
||
1124 | 4923 |
! ! |
1078 | 4924 |
|
388 | 4925 |
!MenuPanel::Item class methodsFor:'instance creation'! |
4926 |
||
4927 |
in:aSuperMenu |
|
4928 |
^ self in:aSuperMenu label:nil |
|
4929 |
! |
|
4930 |
||
4931 |
in:aSuperMenu label:aLabel |
|
4932 |
|item| |
|
4933 |
||
4934 |
item := self new in:aSuperMenu. |
|
4935 |
item label:aLabel. |
|
4936 |
^ item |
|
4937 |
! |
|
4938 |
||
4939 |
in:aSuperMenu menuItem:aMenuItem |
|
4940 |
|item| |
|
4941 |
||
4942 |
item := self in:aSuperMenu. |
|
4943 |
item menuItem:aMenuItem. |
|
4944 |
^ item. |
|
2359 | 4945 |
! |
4946 |
||
4947 |
new |
|
4948 |
^ self basicNew initialize |
|
388 | 4949 |
! ! |
4950 |
||
1808 | 4951 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 4952 |
|
420 | 4953 |
canAccept |
4954 |
"returns true if item is acceptable |
|
4955 |
" |
|
2199 | 4956 |
self enabled ifFalse:[ ^ false]. |
4957 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
4958 |
||
4959 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
4960 |
^ subMenu isNil or:[subMenu shown not] |
|
524 | 4961 |
! |
4962 |
||
4963 |
toggleIndication |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4964 |
"toggle indication or choice |
524 | 4965 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4966 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4967 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4968 |
indication notNil ifTrue:[ |
2359 | 4969 |
arg := self indicationValue not. |
4970 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4971 |
] ifFalse:[ |
2359 | 4972 |
choice notNil ifTrue:[ |
4973 |
choice value:(menuItem choiceValue). |
|
4974 |
^ true |
|
4975 |
] |
|
524 | 4976 |
]. |
4977 |
^ arg |
|
389 | 4978 |
! ! |
4979 |
||
388 | 4980 |
!MenuPanel::Item methodsFor:'accessing'! |
4981 |
||
4982 |
accessCharacter |
|
389 | 4983 |
"returns my accessCharacter or nil |
388 | 4984 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4985 |
^ accessCharacter |
388 | 4986 |
! |
4987 |
||
4988 |
accessCharacterPosition |
|
390 | 4989 |
"get the access character position or nil |
388 | 4990 |
" |
2359 | 4991 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4992 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4993 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4994 |
accessCharacterPosition:anIndex |
390 | 4995 |
"set the access character position or nil |
388 | 4996 |
" |
2359 | 4997 |
menuItem accessCharacterPosition:anIndex. |
388 | 4998 |
! |
4999 |
||
5000 |
argument |
|
5001 |
"gets the argument |
|
5002 |
" |
|
2359 | 5003 |
^ menuItem argument |
388 | 5004 |
! |
5005 |
||
5006 |
argument:anArgument |
|
5007 |
"sets the argument |
|
5008 |
" |
|
2359 | 5009 |
menuItem argument:anArgument. |
389 | 5010 |
! |
5011 |
||
1727 | 5012 |
font |
5013 |
"returns the user configured font or nil (default menu font) |
|
5014 |
" |
|
5015 |
^ font |
|
5016 |
! |
|
5017 |
||
5018 |
font:aFont |
|
5019 |
"returns the user configured font or nil (default menu font) |
|
5020 |
" |
|
2362 | 5021 |
self isSeparator ifTrue:[^ self]. |
5022 |
||
1727 | 5023 |
aFont ~= font ifTrue:[ |
2362 | 5024 |
aFont notNil ifTrue:[ |
5025 |
font := aFont onDevice:(menuPanel device) |
|
5026 |
] ifFalse:[ |
|
5027 |
"/ use font from menupanel |
|
5028 |
font := nil |
|
5029 |
]. |
|
5030 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5031 |
rawLabel isString ifTrue:[ |
2362 | 5032 |
"have to recompute the extent" |
5033 |
self label:label |
|
5034 |
] |
|
1727 | 5035 |
]. |
5036 |
! |
|
5037 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5038 |
itemValue |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5039 |
"gets value |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5040 |
" |
2360 | 5041 |
^ menuItem itemValue |
5042 |
! |
|
5043 |
||
5044 |
itemValue:aValue |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5045 |
"argument could be a value holder, an action or selector |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5046 |
" |
2360 | 5047 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5048 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5049 |
|
388 | 5050 |
label |
5051 |
"returns the label |
|
5052 |
" |
|
5053 |
^ label |
|
5054 |
! |
|
5055 |
||
5056 |
label:aLabel |
|
399 | 5057 |
"set a new label; if the label changed, a redraw is performed; |
5058 |
handle characters $& (ST-80 compatibility) |
|
388 | 5059 |
" |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5060 |
|size char lbl mfont f oldExtent |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5061 |
h "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5062 |
w "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5063 |
| |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5064 |
oldExtent := rawLabelExtent. |
2362 | 5065 |
rawLabelExtent := 0@0. |
5066 |
accessCharacter := disabledRawLabel := nil. |
|
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5067 |
label := aLabel value. |
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5068 |
rawLabel := label value ? ''. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5069 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5070 |
rawLabel isString ifTrue:[ |
2359 | 5071 |
"CHECK FOR SEPARATOR" |
5072 |
||
5073 |
(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[ |
|
5074 |
size := rawLabel size. |
|
5075 |
||
5076 |
size == 0 ifTrue:[ |
|
5077 |
rawLabel := nil. "blank separator" |
|
5078 |
^ self |
|
5079 |
]. |
|
5080 |
||
5081 |
size == 1 ifTrue:[ |
|
5082 |
char := rawLabel first. |
|
5083 |
||
5084 |
(char == $- or:[char == $=]) ifTrue:[ |
|
5085 |
label := rawLabel. "line separator" |
|
5086 |
rawLabel := nil. |
|
5087 |
^ self |
|
5088 |
] |
|
5089 |
] |
|
5090 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5091 |
] ifFalse:[ |
2359 | 5092 |
rawLabel isCollection ifTrue:[ |
5093 |
rawLabel := rawLabel asArray. |
|
5094 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5095 |
]. |
1727 | 5096 |
mfont := menuPanel setFont:font. |
5097 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5098 |
rawLabel isArray ifTrue:[ |
2359 | 5099 |
w := h := 0. |
5100 |
||
5101 |
rawLabel keysAndValuesDo:[:i :el| |
|
5102 |
el notNil ifTrue:[ |
|
5103 |
lbl := self updateAccessCharacterFor:el. |
|
5104 |
rawLabel at:i put:lbl. |
|
5105 |
w := w max:(lbl widthOn:menuPanel). |
|
5106 |
h := h + 1 + (lbl heightOn:menuPanel). |
|
5107 |
] ifFalse:[ |
|
5108 |
h := h + 3 |
|
5109 |
] |
|
5110 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5111 |
] ifFalse:[ |
2359 | 5112 |
rawLabel := self updateAccessCharacterFor:rawLabel. |
5113 |
w := rawLabel widthOn:menuPanel. |
|
5114 |
h := rawLabel heightOn:menuPanel. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5115 |
]. |
1797
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
5116 |
|
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
5117 |
"/ 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
|
5118 |
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
|
5119 |
(f notNil and:[f italic]) ifTrue:[ |
2359 | 5120 |
w := w + 2. |
1797
28327a68241b
give a few more pixels at the right if the used font is
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
5121 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5122 |
rawLabelExtent := w@h. |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5123 |
|
1727 | 5124 |
menuPanel setFont:mfont. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5125 |
menuPanel shown ifTrue:[ self fetchImages ]. |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5126 |
|
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5127 |
oldExtent = rawLabelExtent ifTrue:[ |
2359 | 5128 |
self invalidate |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5129 |
] ifFalse:[ |
2359 | 5130 |
menuPanel mustRearrange |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5131 |
]. |
388 | 5132 |
! |
5133 |
||
5134 |
menuPanel |
|
5135 |
"returns my menuPanel |
|
5136 |
" |
|
399 | 5137 |
^ menuPanel |
388 | 5138 |
! |
5139 |
||
5140 |
nameKey |
|
5141 |
"gets the nameKey |
|
5142 |
" |
|
2359 | 5143 |
^ menuItem nameKey |
388 | 5144 |
! |
5145 |
||
5146 |
nameKey:aNameKey |
|
5147 |
"sets the nameKey |
|
5148 |
" |
|
2359 | 5149 |
menuItem nameKey:aNameKey. |
388 | 5150 |
! |
5151 |
||
5152 |
rawLabel |
|
390 | 5153 |
"returns my printable Label |
388 | 5154 |
" |
5155 |
^ rawLabel |
|
5156 |
! |
|
5157 |
||
5158 |
shortcutKey |
|
5159 |
"get the key to press to select the submenu from the keyboard or if |
|
5160 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5161 |
" |
|
2359 | 5162 |
^ menuItem shortcutKey |
388 | 5163 |
! |
5164 |
||
5165 |
shortcutKey:aKey |
|
5166 |
"set the key to press to select the submenu from the keyboard or if |
|
5167 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5168 |
" |
|
2359 | 5169 |
menuItem shortcutKey ~= aKey ifTrue:[ |
5170 |
menuItem shortcutKey:aKey. |
|
5171 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5172 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5173 |
! |
388 | 5174 |
|
710 | 5175 |
startGroup |
5176 |
"start group #left #right #center ... or nil |
|
5177 |
at the moment only #right is implemented |
|
5178 |
" |
|
2359 | 5179 |
^ menuItem startGroup |
710 | 5180 |
! |
5181 |
||
5182 |
startGroup:aSymbol |
|
5183 |
"start group #left #right #center ... |
|
5184 |
at the moment only #right is implemented |
|
5185 |
" |
|
2359 | 5186 |
menuItem startGroup:aSymbol. |
710 | 5187 |
! |
5188 |
||
388 | 5189 |
submenu |
5190 |
"returns my submenu or nil |
|
5191 |
" |
|
464 | 5192 |
subMenu notNil ifTrue:[^ subMenu]. |
5193 |
^ self setupSubmenu |
|
388 | 5194 |
! |
5195 |
||
5196 |
submenu:aSubMenu |
|
5197 |
"set a new submenu; an existing submenu will be destroyed. This might lead |
|
5198 |
to a redraw if 'hasSubmenu' changed |
|
5199 |
" |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5200 |
|widget| |
1767 | 5201 |
|
5202 |
aSubMenu isNil ifTrue:[ |
|
2360 | 5203 |
subMenu notNil ifTrue:[ |
5204 |
subMenu destroy. |
|
5205 |
subMenu := nil. |
|
5206 |
]. |
|
5207 |
^ self |
|
1767 | 5208 |
]. |
5209 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5210 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
2360 | 5211 |
subMenu := MenuPanel new. |
5212 |
||
5213 |
menuPanel notNil ifTrue:[ |
|
5214 |
subMenu receiver:menuPanel receiver. |
|
5215 |
]. |
|
5216 |
subMenu superMenu:menuPanel. |
|
5217 |
||
5218 |
menuItem horizontalLayout == true ifTrue:[ |
|
5219 |
subMenu verticalLayout:false |
|
5220 |
]. |
|
5221 |
subMenu menu:aSubMenu. |
|
1767 | 5222 |
] ifFalse:[ |
2360 | 5223 |
aSubMenu isView ifFalse:[ |
5224 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
5225 |
"/ ... mhhhh .... |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5226 |
^ menuItem submenuChannel:aSubMenu |
2360 | 5227 |
]. |
5228 |
widget := SimpleView new. |
|
5229 |
widget client:aSubMenu. |
|
5230 |
] ifTrue:[ |
|
5231 |
widget := aSubMenu |
|
5232 |
]. |
|
5233 |
||
5234 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
5235 |
subMenu := widget. |
|
5236 |
||
5237 |
menuItem horizontalLayout == true ifTrue:[ |
|
5238 |
subMenu verticalLayout:false |
|
5239 |
]. |
|
5240 |
] ifFalse:[ |
|
5241 |
subMenu := MenuPanel new. |
|
5242 |
subMenu receiver:menuPanel receiver. |
|
5243 |
subMenu addSubView:widget. |
|
5244 |
subMenu extent:(widget preferredExtent). |
|
5245 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
5246 |
]. |
|
5247 |
subMenu superMenu:menuPanel. |
|
5248 |
]. |
|
389 | 5249 |
! |
5250 |
||
390 | 5251 |
textLabel |
5252 |
"returns my textLabel or nil if none text |
|
5253 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5254 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5255 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5256 |
rawLabel notNil ifTrue:[ |
2219 | 5257 |
rawLabel isArray ifFalse:[ |
5258 |
^ rawLabel perform:#string ifNotUnderstood:nil |
|
5259 |
]. |
|
5260 |
||
5261 |
rawLabel do:[:el| |
|
5262 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
|
5263 |
^ txt |
|
5264 |
] |
|
5265 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5266 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5267 |
^ nil |
1699 | 5268 |
|
390 | 5269 |
! |
5270 |
||
1841 | 5271 |
triggerOnDown |
5272 |
"trigger the action if pressed |
|
5273 |
" |
|
2359 | 5274 |
menuItem triggerOnDown ifTrue:[ |
5275 |
self hasSubmenu ifFalse:[^ true]. |
|
1841 | 5276 |
]. |
5277 |
^ false |
|
5278 |
! |
|
5279 |
||
5280 |
triggerOnDown:aBool |
|
5281 |
"trigger the action if pressed |
|
5282 |
" |
|
2359 | 5283 |
menuItem triggerOnDown:aBool. |
1841 | 5284 |
! |
5285 |
||
389 | 5286 |
value |
5287 |
"gets value |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5288 |
Left here for ST80 compatibility - value is a bad name |
389 | 5289 |
" |
2360 | 5290 |
^ menuItem itemValue |
5291 |
! |
|
5292 |
||
5293 |
value:aValue |
|
389 | 5294 |
"could be a value holder, an action or selector |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5295 |
Left here for ST80 compatibility - value: is a bad name |
389 | 5296 |
" |
2360 | 5297 |
menuItem itemValue:aValue. |
502 | 5298 |
! |
5299 |
||
5300 |
value:aValue argument:anArgument |
|
5301 |
"set the value and an argument |
|
5302 |
" |
|
2360 | 5303 |
menuItem itemValue:aValue. |
5304 |
menuItem argument:anArgument. |
|
388 | 5305 |
! ! |
5306 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5307 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5308 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5309 |
choice |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5310 |
"implements a radio group; the field |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5311 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5312 |
^ choice |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5313 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5314 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5315 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5316 |
choice:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5317 |
"set choice indication |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5318 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5319 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5320 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5321 |
choice isValueModel ifTrue:[ |
2219 | 5322 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5323 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5324 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5325 |
(choice := something) notNil ifTrue:[ |
2219 | 5326 |
choice isSymbol ifTrue:[ |
5327 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
5328 |
choice := something |
|
5329 |
] |
|
5330 |
]. |
|
5331 |
choice isValueModel ifTrue:[ |
|
5332 |
choice addDependent:self |
|
5333 |
] |
|
1699 | 5334 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5335 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5336 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5337 |
choiceValue |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5338 |
"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
|
5339 |
" |
2359 | 5340 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5341 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5342 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5343 |
choiceValue:something |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5344 |
"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
|
5345 |
" |
2359 | 5346 |
menuItem choiceValue ~= something ifTrue:[ |
5347 |
menuItem choiceValue:something. |
|
5348 |
choice notNil ifTrue:[ self invalidate ]. |
|
5349 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5350 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5351 |
|
388 | 5352 |
enabled |
5353 |
"returns the enabled state |
|
5354 |
" |
|
524 | 5355 |
|state| |
5356 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5357 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5358 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5359 |
enableChannel isSymbol ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5360 |
state := self aspectAt:enableChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5361 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5362 |
state isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5363 |
self ifNotInUIBuilderInfoPrintCR: |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5364 |
('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')'). |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5365 |
^ true |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5366 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5367 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5368 |
state isValueModel ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5369 |
enableChannel := state. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5370 |
enableChannel addDependent:self. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5371 |
state := enableChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5372 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5373 |
state := state value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5374 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5375 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5376 |
state := enableChannel value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5377 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5378 |
^ state ~~ false |
388 | 5379 |
! |
5380 |
||
389 | 5381 |
enabled:something |
388 | 5382 |
"change the enabled state; if the state changed, a redraw is performed |
5383 |
" |
|
390 | 5384 |
|oldState newState| |
5385 |
||
5386 |
enableChannel isNil ifTrue:[ |
|
2219 | 5387 |
oldState := true |
390 | 5388 |
] ifFalse:[ |
2219 | 5389 |
oldState := enableChannel value. |
5390 |
enableChannel isValueModel ifTrue:[ |
|
5391 |
enableChannel removeDependent:self |
|
5392 |
] |
|
388 | 5393 |
]. |
390 | 5394 |
enableChannel := something. |
5395 |
||
5396 |
enableChannel isNil ifTrue:[ |
|
2219 | 5397 |
menuPanel shown ifFalse:[^ self]. |
5398 |
newState := true |
|
390 | 5399 |
] ifFalse:[ |
2219 | 5400 |
enableChannel isValueModel ifTrue:[ |
5401 |
enableChannel addDependent:self |
|
5402 |
] ifFalse:[ |
|
5403 |
enableChannel isSymbol ifTrue:[^ self] |
|
5404 |
]. |
|
5405 |
menuPanel shown ifFalse:[^ self]. |
|
5406 |
newState := enableChannel value. |
|
390 | 5407 |
]. |
5408 |
||
5409 |
newState ~~ oldState ifTrue:[ |
|
2219 | 5410 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5411 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5412 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5413 |
|
1670 | 5414 |
hideMenuOnActivated |
5415 |
"hide the menu when the item was activated; the default is true |
|
5416 |
" |
|
2359 | 5417 |
^ menuItem hideMenuOnActivated |
1670 | 5418 |
! |
5419 |
||
5420 |
hideMenuOnActivated:aBool |
|
5421 |
"hide the menu when the item was activated; the default is true |
|
5422 |
" |
|
2359 | 5423 |
menuItem hideMenuOnActivated:aBool. |
1670 | 5424 |
! |
5425 |
||
2216 | 5426 |
ifNotInUIBuilderInfoPrintCR:aMessage |
5427 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
5428 |
||
5429 |
(menuPanel receiver isNil |
|
5430 |
and:[ menuPanel application notNil |
|
5431 |
and:[ menuPanel application askFor:#isUIPainter]]) |
|
5432 |
ifTrue:[ |
|
2219 | 5433 |
^ self "/ suppressed |
2216 | 5434 |
]. |
5435 |
aMessage infoPrintCR |
|
5436 |
! |
|
5437 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5438 |
indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5439 |
"get on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5440 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5441 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5442 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5443 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5444 |
indication:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5445 |
"set on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5446 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5447 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5448 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5449 |
indication isValueModel ifTrue:[ |
2219 | 5450 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5451 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5452 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5453 |
(indication := something) notNil ifTrue:[ |
2219 | 5454 |
indication isValueModel ifTrue:[ |
5455 |
indication addDependent:self |
|
5456 |
] ifFalse:[ |
|
5457 |
"/ to force an update of the value |
|
5458 |
self indicationValue |
|
5459 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5460 |
]. |
464 | 5461 |
! |
5462 |
||
1767 | 5463 |
keepLinkedMenu |
5464 |
"get the keepLinkedMenu flag |
|
5465 |
" |
|
2359 | 5466 |
^ menuItem keepLinkedMenu |
5467 |
! |
|
5468 |
||
5469 |
keepLinkedMenu:aBool |
|
1767 | 5470 |
"get the keepLinkedMenu flag |
5471 |
" |
|
2359 | 5472 |
menuItem keepLinkedMenu:aBool. |
1767 | 5473 |
! |
5474 |
||
2331 | 5475 |
sendToOriginator |
5476 |
"if true, the message is sent to the originating widget; |
|
5477 |
otherwise (the default), it it sent to the receiver/application." |
|
5478 |
||
2359 | 5479 |
^ menuItem sendToOriginator |
2331 | 5480 |
! |
5481 |
||
5482 |
sendToOriginator:aBoolean |
|
5483 |
"if true, the message is sent to the originating widget; |
|
5484 |
otherwise (the default), it it sent to the receiver/application." |
|
5485 |
||
2359 | 5486 |
menuItem sendToOriginator:aBoolean. |
2331 | 5487 |
! |
5488 |
||
464 | 5489 |
submenuChannel |
5490 |
"get the submenu channel |
|
5491 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5492 |
^ menuItem submenuChannel |
464 | 5493 |
! |
5494 |
||
5495 |
submenuChannel:aSelectorOrNil |
|
5496 |
"returns the submenu channel |
|
5497 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5498 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 5499 |
! ! |
5500 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5501 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 5502 |
|
2016 | 5503 |
moveBy:aPoint |
5504 |
"move layout origin |
|
5505 |
" |
|
5506 |
layout moveBy:aPoint. |
|
5507 |
! |
|
5508 |
||
1699 | 5509 |
preferredExtent |
5510 |
"compute my preferred extent excluding the shortCutKey and the menu identifier |
|
5511 |
" |
|
2359 | 5512 |
|isVertical icon wIcon isButton |
1699 | 5513 |
x "{ Class:SmallInteger }" |
5514 |
y "{ Class:SmallInteger }" |
|
5515 |
s "{ Class:SmallInteger }" |
|
5516 |
| |
|
5517 |
self isVisible ifFalse:[^ 0@0 ]. |
|
5518 |
||
2359 | 5519 |
isButton := menuItem isButton. |
5520 |
||
1699 | 5521 |
isButton ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5522 |
s := menuPanel maxAbsoluteButtonLevel. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5523 |
x := s + HorizontalButtonInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5524 |
y := s + VerticalButtonInset. |
1699 | 5525 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5526 |
x := HorizontalInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5527 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 5528 |
]. |
5529 |
x := x * 2. |
|
5530 |
y := y * 2. |
|
5531 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5532 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5533 |
|
2362 | 5534 |
self isSeparator ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5535 |
"SEPARATOR" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5536 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5537 |
s := self class separatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5538 |
label = '' ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5539 |
s := self class halfSeparatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5540 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5541 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5542 |
"width of doubleSeparator is 5 !!!!" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5543 |
isVertical ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5544 |
x := x max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5545 |
y := y + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5546 |
] ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5547 |
y := y max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5548 |
x := x + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5549 |
]. |
1699 | 5550 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5551 |
x := x + rawLabelExtent x. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5552 |
y := y + rawLabelExtent y. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5553 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5554 |
isButton ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5555 |
menuPanel showSeparatingLines ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5556 |
"width of separator is 2 plus right offset 1 := 3" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5557 |
isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5558 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5559 |
(indication notNil or:[choice notNil]) ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5560 |
x := x + 2 + menuPanel iconIndicationOff width. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5561 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5562 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5563 |
wIcon := 0. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5564 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5565 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5566 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5567 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5568 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5569 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5570 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5571 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5572 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5573 |
x := x + wIcon. |
1699 | 5574 |
]. |
5575 |
^ x@y |
|
388 | 5576 |
! ! |
5577 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5578 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 5579 |
|
5580 |
activeHelpKey |
|
5581 |
"get the active helpKey; the key to retrieve the helpText from the application |
|
5582 |
" |
|
2359 | 5583 |
^ menuItem activeHelpKey |
1613 | 5584 |
! |
5585 |
||
5586 |
activeHelpKey:aHelpKey |
|
5587 |
"set the active helpKey; the key to retrieve the helpText from the application |
|
5588 |
" |
|
2359 | 5589 |
menuItem activeHelpKey:aHelpKey. |
5590 |
activeHelpText := nil. |
|
1613 | 5591 |
! |
5592 |
||
5593 |
activeHelpText |
|
5594 |
"get the active helpText or nil if not yet resolved |
|
5595 |
" |
|
5596 |
^ activeHelpText |
|
5597 |
! |
|
5598 |
||
5599 |
activeHelpText:aText |
|
5600 |
"set the active helpText |
|
5601 |
" |
|
5602 |
activeHelpText := aText. |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5603 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5604 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5605 |
flyByHelpText |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5606 |
"get the flyBy helpText or nil if not yet resolved |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5607 |
" |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5608 |
^ flyByHelpText |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5609 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5610 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5611 |
flyByHelpText:aText |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5612 |
"set the flyBy helpText |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5613 |
" |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5614 |
flyByHelpText := aText. |
1613 | 5615 |
! ! |
5616 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5617 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5618 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5619 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5620 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5621 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5622 |
" |
2360 | 5623 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5624 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5625 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5626 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5627 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5628 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5629 |
" |
2360 | 5630 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5631 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5632 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5633 |
isButton |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5634 |
"returns whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5635 |
" |
2359 | 5636 |
^ menuItem isButton |
5637 |
! |
|
5638 |
||
5639 |
isButton:aBool |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5640 |
"sets whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5641 |
" |
2359 | 5642 |
menuItem isButton ~~ aBool ifTrue:[ |
5643 |
menuItem isButton:aBool. |
|
5644 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5645 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5646 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5647 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5648 |
layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5649 |
"returns my layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5650 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5651 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5652 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5653 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5654 |
layout:aLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5655 |
"set a new layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5656 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5657 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5658 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5659 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5660 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5661 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5662 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5663 |
"get the flag which controls if a busy cursor is to be shown |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5664 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5665 |
" |
2359 | 5666 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5667 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5668 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5669 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5670 |
"set/clear the flag which controls if a busy cursor is to be shown |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5671 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5672 |
" |
2359 | 5673 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5674 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5675 |
|
1705 | 5676 |
!MenuPanel::Item methodsFor:'activation / deactivation'! |
5677 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5678 |
currentSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5679 |
"returns the current submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5680 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5681 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5682 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5683 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5684 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5685 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5686 |
|
1705 | 5687 |
hideSubmenu |
5688 |
"hide submenu |
|
5689 |
" |
|
2199 | 5690 |
self hideSubmenu:subMenu. |
5691 |
! |
|
5692 |
||
5693 |
hideSubmenu:aSubmenu |
|
5694 |
"hide submenu |
|
5695 |
" |
|
1705 | 5696 |
|id| |
5697 |
||
2199 | 5698 |
aSubmenu ifNil:[^ self]. |
5699 |
||
5700 |
aSubmenu realized ifFalse:[ |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5701 |
id := aSubmenu id. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5702 |
id ifNotNil:[ menuPanel device unmapWindow:id ] |
2199 | 5703 |
] ifTrue:[ |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5704 |
aSubmenu hide |
2199 | 5705 |
]. |
5706 |
||
5707 |
aSubmenu windowGroup:nil. |
|
5708 |
menuPanel windowGroup removeView:aSubmenu. |
|
5709 |
||
5710 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5711 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5712 |
menuItem keepLinkedMenu ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5713 |
subMenu := nil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5714 |
] |
2199 | 5715 |
]. |
5716 |
! |
|
5717 |
||
5718 |
openDelayedSubmenu |
|
5719 |
"called to open now my delayed submenu |
|
5720 |
" |
|
5721 |
|subm| |
|
5722 |
||
5723 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
5724 |
||
5725 |
subMenu ifNotNil:[ |
|
2219 | 5726 |
subMenu realized ifTrue:[ |
5727 |
"/ already open |
|
5728 |
^ self |
|
5729 |
]. |
|
2199 | 5730 |
]. |
5731 |
subm := self setupSubmenu. |
|
5732 |
subm ifNil:[^ self]. |
|
5733 |
||
5734 |
self openSubmenu. |
|
5735 |
||
5736 |
(subm == subMenu and:[self isSelected]) ifFalse:[ |
|
2219 | 5737 |
"/ closed during building or opening the submenu |
5738 |
self hideSubmenu:subm. |
|
2199 | 5739 |
]. |
1705 | 5740 |
! |
1701 | 5741 |
|
5742 |
openSubmenu |
|
5743 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
5744 |
is fully visible by shifting it into the visible screen area if |
|
5745 |
nescessary. |
|
5746 |
" |
|
2249 | 5747 |
|p o device isVertical topMenu windGrp prefExtent |
1701 | 5748 |
devBot "{ Class:SmallInteger }" |
5749 |
devRight "{ Class:SmallInteger }" |
|
5750 |
width "{ Class:SmallInteger }" |
|
5751 |
height "{ Class:SmallInteger }" |
|
5752 |
top "{ Class:SmallInteger }" |
|
5753 |
left "{ Class:SmallInteger }" |
|
5754 |
| |
|
5755 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
5756 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
2249 | 5757 |
^ self |
1701 | 5758 |
]. |
5759 |
||
5760 |
topMenu := menuPanel topMenu. |
|
1829 | 5761 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
2249 | 5762 |
subMenu releaseDeviceResources. |
5763 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
5764 |
subMenu recreate. |
|
1829 | 5765 |
]. |
5766 |
||
1701 | 5767 |
windGrp := topMenu windowGroup. |
5768 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5769 |
subMenu superMenu:menuPanel. |
1701 | 5770 |
subMenu becomesActiveMenu. |
5771 |
subMenu cursor:Cursor hand. |
|
5772 |
||
5773 |
windGrp notNil ifTrue:[ |
|
2249 | 5774 |
subMenu windowGroup:windGrp. |
5775 |
windGrp addTopView:subMenu. |
|
1701 | 5776 |
]. |
5777 |
||
2111 | 5778 |
"Q&D kludge - test whether the layout is nil; |
2249 | 5779 |
if true recompute the layouts |
2111 | 5780 |
" |
5781 |
layout ifNil:[menuPanel rearrangeItems]. |
|
5782 |
||
1701 | 5783 |
" Q&D kludge - if any visibility attributes are blocks; |
5784 |
TODO: only invoke mustRearrange if any are blocks |
|
2249 | 5785 |
(since I react correctly on valueHolder changes) |
1701 | 5786 |
" |
5787 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
5788 |
subMenu fixSize. |
|
5789 |
||
5790 |
"compute origin of subMenu |
|
5791 |
" |
|
5792 |
isVertical := menuPanel verticalLayout. |
|
5793 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5794 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5795 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5796 |
width := prefExtent x. |
1701 | 5797 |
devBot := device usableHeight. |
5798 |
devRight := device usableWidth. |
|
5799 |
||
5800 |
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
|
5801 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5802 |
menuPanel isPopUpView ifTrue:[ |
2249 | 5803 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5804 |
] ifFalse:[ |
2249 | 5805 |
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
|
5806 |
]. |
1701 | 5807 |
left := o x. |
5808 |
top := o y. |
|
5809 |
||
2016 | 5810 |
top + height > devBot ifTrue:[ |
2249 | 5811 |
top := isVertical ifTrue:[devBot - height] |
5812 |
ifFalse:[top - layout height - height + 2] |
|
2016 | 5813 |
]. |
5814 |
top := top max:0. |
|
5815 |
||
5816 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
5817 |
"/ top < menuPanel bottom ifTrue:[ |
|
5818 |
"/ left := left + layout width. |
|
5819 |
"/ ]. |
|
5820 |
"/ left + width > devRight ifTrue:[ |
|
5821 |
"/ left := o x - width - 2 |
|
5822 |
"/ ]. |
|
5823 |
"/ ]. |
|
5824 |
||
1701 | 5825 |
left + width > devRight ifTrue:[ |
2249 | 5826 |
left := isVertical ifTrue:[left - layout width - width + 2] |
5827 |
ifFalse:[devRight - width] |
|
1701 | 5828 |
]. |
5829 |
left := left max:0. |
|
5830 |
||
5831 |
subMenu origin:(left@top). |
|
5832 |
||
5833 |
subMenu realized ifFalse:[ |
|
2249 | 5834 |
subMenu realize. |
1701 | 5835 |
] ifTrue:[ |
2249 | 5836 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5837 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5838 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5839 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5840 |
toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5841 |
"toggle the visibility of the submenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5842 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5843 |
subMenu notNil ifTrue:[ |
2219 | 5844 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5845 |
] ifFalse:[ |
2219 | 5846 |
(subMenu := self setupSubmenu) isNil ifTrue:[ |
5847 |
"/ cannot open a submenu |
|
5848 |
^ self |
|
5849 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5850 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5851 |
self openSubmenu. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5852 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5853 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5854 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5855 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5856 |
visibleSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5857 |
"returns the current visible submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5858 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5859 |
subMenu notNil ifTrue:[ |
2219 | 5860 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5861 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5862 |
^ nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5863 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5864 |
|
1701 | 5865 |
|
5866 |
! ! |
|
5867 |
||
524 | 5868 |
!MenuPanel::Item methodsFor:'building'! |
5869 |
||
5870 |
aspectAt:aKey |
|
5871 |
"retursns value assigned to key or nil |
|
5872 |
" |
|
5873 |
|appl value| |
|
5874 |
||
5875 |
appl := menuPanel receiver. |
|
5876 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
5877 |
(appl isValueModel) ifTrue:[ |
2359 | 5878 |
^ appl value:aKey |
524 | 5879 |
]. |
5880 |
||
2123 | 5881 |
appl isNil ifTrue:[ |
2359 | 5882 |
appl := menuPanel application. |
2123 | 5883 |
]. |
5884 |
appl isNil ifTrue:[ ^ nil]. |
|
5885 |
||
5886 |
MessageNotUnderstood handle:[:ex| |
|
2359 | 5887 |
ex selector == aKey ifFalse:[ |
5888 |
ex reject |
|
5889 |
]. |
|
5890 |
self ifNotInUIBuilderInfoPrintCR: |
|
5891 |
('MenuPanel::Item [info]: application does not provide aspect: ' , aKey). |
|
2123 | 5892 |
] do:[ |
2359 | 5893 |
aKey numArgs == 1 ifTrue:[ |
5894 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
5895 |
] ifFalse:[ |
|
5896 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
5897 |
value := appl aspectFor:aKey |
|
5898 |
] ifFalse:[ |
|
5899 |
value := appl perform:aKey |
|
5900 |
] |
|
5901 |
] |
|
524 | 5902 |
]. |
5903 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
5904 |
|
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
5905 |
"Modified: / 29.7.1998 / 11:59:50 / cg" |
524 | 5906 |
! ! |
5907 |
||
390 | 5908 |
!MenuPanel::Item methodsFor:'change & update'! |
5909 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5910 |
update:something with:aParameter from:changedObject |
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 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5913 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5914 |
(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
|
5915 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5916 |
self isSeparator ifFalse:[ |
2359 | 5917 |
"/ NOT A SEPARATOR |
5918 |
||
5919 |
menuPanel shown ifTrue:[ |
|
5920 |
changedObject == enableChannel ifTrue:[ |
|
5921 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
5922 |
^ menuPanel selection:nil. |
|
5923 |
]. |
|
5924 |
^ self invalidate |
|
5925 |
]. |
|
5926 |
||
5927 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
5928 |
menuItem isButton ifTrue:[ |
|
5929 |
self invalidate |
|
5930 |
] ifFalse:[ |
|
5931 |
"/ invalidate the interactor only |
|
5932 |
"/ take any interactor; interactors has the same extent |
|
5933 |
form := menuPanel iconIndicationOff. |
|
5934 |
||
5935 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
5936 |
top:(layout top) |
|
5937 |
width:(form width) |
|
5938 |
height:(layout height). |
|
5939 |
||
5940 |
menuPanel invalidate:rect repairNow:false |
|
5941 |
]. |
|
5942 |
^ self |
|
5943 |
]. |
|
5944 |
]. |
|
498 | 5945 |
]. |
712 | 5946 |
|
5947 |
changedObject == isVisible ifTrue:[ |
|
2359 | 5948 |
menuPanel mustRearrange. |
5949 |
menuPanel rearrangeItems. |
|
5950 |
^ self. |
|
712 | 5951 |
]. |
5952 |
||
498 | 5953 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5954 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5955 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5956 |
updateIndicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5957 |
"update indicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5958 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5959 |
(indication notNil and:[indication isSymbol]) ifTrue:[ |
2219 | 5960 |
" indication is a selector otherwise a change notification |
5961 |
is raised from the model !!!! |
|
5962 |
" |
|
5963 |
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
|
5964 |
] |
390 | 5965 |
! ! |
5966 |
||
388 | 5967 |
!MenuPanel::Item methodsFor:'converting'! |
5968 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5969 |
asMenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5970 |
"convert to a MenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5971 |
" |
2359 | 5972 |
^ menuItem |
388 | 5973 |
! |
5974 |
||
5975 |
menuItem:aMenuItem |
|
5976 |
"setup attributes from a MenuItem |
|
5977 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5978 |
|lbl| |
389 | 5979 |
|
388 | 5980 |
menuPanel disabledRedrawDo:[ |
2359 | 5981 |
menuItem := aMenuItem. |
5982 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
5983 |
||
2360 | 5984 |
label := rawLabel := activeHelpText := nil. |
2359 | 5985 |
|
5986 |
self font:(menuItem font). |
|
5987 |
||
5988 |
self enabled:(menuItem enabled). |
|
5989 |
self indication:(menuItem indication). |
|
5990 |
self choice:(menuItem choice). |
|
5991 |
self isVisible:(menuItem isVisible ? true). |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5992 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5993 |
"/ we should call here resourceRetriever insteat of labelImage |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5994 |
"/ but ... ?? |
2359 | 5995 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
5996 |
lbl := menuItem rawLabel. "/ avoid translating &'s twice |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5997 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5998 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5999 |
self submenu:(menuItem submenu). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6000 |
self label:lbl. |
388 | 6001 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
6002 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
6003 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 6004 |
! ! |
6005 |
||
6006 |
!MenuPanel::Item methodsFor:'drawing'! |
|
6007 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6008 |
drawButton |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6009 |
"draw as button |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6010 |
" |
2362 | 6011 |
|drawObject fg etchFg level isEnabled isSelected bg ownBgCol showSelected |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6012 |
x "{ Class:SmallInteger }" |
2143 | 6013 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6014 |
| |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6015 |
drawObject := rawLabel. |
2362 | 6016 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
6017 |
isSelected := self isSelected. |
2362 | 6018 |
|
6019 |
isSelected ifFalse:[ |
|
6020 |
"/ test whether button has pressed toggle behaviour |
|
6021 |
showSelected := (self isToggle and:[self indicationValue]). |
|
6022 |
] ifTrue:[ |
|
6023 |
showSelected := isSelected |
|
6024 |
]. |
|
6025 |
||
6026 |
showSelected ifTrue:[ |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6027 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6028 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6029 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6030 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6031 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6032 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6033 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6034 |
]. |
2059 | 6035 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6036 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6037 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6038 |
fg := menuPanel disabledForegroundColor. |
2059 | 6039 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6040 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6041 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6042 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6043 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6044 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6045 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6046 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6047 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6048 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6049 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6050 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6051 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6052 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6053 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6054 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 6055 |
|
6056 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
2337 | 6057 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
6058 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6059 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6060 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6061 |
"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
|
6062 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6063 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6064 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6065 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6066 |
] ifFalse:[ |
2359 | 6067 |
isSelected := (choice notNil and:[choice value = menuItem choiceValue]). |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6068 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6069 |
]. |
2143 | 6070 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6071 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6072 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6073 |
level := menuPanel buttonActiveLevel. |
2142 | 6074 |
x := x + 1 "level abs". |
2143 | 6075 |
y := y + 1 "level abs". |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6076 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6077 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2219 | 6078 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 6079 |
]. |
6080 |
||
2362 | 6081 |
drawObject isEmptyOrNil ifFalse:[ |
6082 |
etchFg notNil ifTrue:[ |
|
6083 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
6084 |
]. |
|
6085 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
6086 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6087 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6088 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6089 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6090 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6091 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6092 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6093 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6094 |
drawLabel |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6095 |
"draw a labeled entry; no button, no separator. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6096 |
" |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6097 |
|scKey cLb cLa drawObject fg etchFg arrow |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6098 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6099 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6100 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6101 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6102 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6103 |
| |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6104 |
drawObject := rawLabel. |
2362 | 6105 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6106 |
isSelected := self isSelected. |
2362 | 6107 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6108 |
isSelected ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6109 |
fg := self activeForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6110 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6111 |
isEnabled ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6112 |
self isEntered ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6113 |
fg := menuPanel enteredForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6114 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6115 |
fg := menuPanel foregroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6116 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6117 |
] ifFalse:[ |
2362 | 6118 |
fg := menuPanel disabledForegroundColor. |
6119 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
6120 |
drawObject := self disabledRawLabel |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6121 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6122 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6123 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6124 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6125 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6126 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6127 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6128 |
((form := self indicatorForm) notNil or:[(form := self choiceForm) notNil]) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6129 |
y := t + ((h - form height) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6130 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6131 |
form displayOn:menuPanel x:x y:y. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6132 |
x := x + 2 + form width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6133 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6134 |
|
2362 | 6135 |
drawObject isEmptyOrNil ifFalse:[ |
6136 |
etchFg notNil ifTrue:[ |
|
6137 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
6138 |
]. |
|
6139 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
6140 |
]. |
|
6141 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6142 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6143 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6144 |
"/ DRAW SHORTCUT KEY |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6145 |
|
2359 | 6146 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6147 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6148 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6149 |
) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6150 |
x := layout left + x. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6151 |
y := t + ((h - (scKey heightOn:menuPanel)) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6152 |
y := y + menuPanel font ascent. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6153 |
scKey displayOn:menuPanel x:x y:y. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6154 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6155 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6156 |
"/ DRAW SUBMENU INDICATION |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6157 |
|
2362 | 6158 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[ |
6159 |
^ self |
|
6160 |
]. |
|
6161 |
arrow := menuPanel rightArrow. |
|
6162 |
x := layout right - arrow width - HorizontalInset. |
|
6163 |
y := t + (h - arrow height // 2). |
|
6164 |
||
6165 |
(menuPanel styleSheet is3D not |
|
6166 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
6167 |
^ menuPanel displayForm:arrow x:x y:y |
|
6168 |
]. |
|
6169 |
cLa := menuPanel shadowColor. |
|
6170 |
cLb := menuPanel lightColor. |
|
6171 |
||
6172 |
isSelected ifFalse:[ |
|
6173 |
fg := cLa. |
|
6174 |
cLa := cLb. |
|
6175 |
cLb := fg |
|
6176 |
]. |
|
6177 |
menuPanel paint:cLa. |
|
6178 |
menuPanel displayForm:arrow x:x y:y. |
|
6179 |
menuPanel paint:cLb. |
|
6180 |
menuPanel displayForm:drawObject x:x y:y. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6181 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6182 |
"Modified: / 6.9.1998 / 21:48:53 / cg" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6183 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6184 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6185 |
drawMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6186 |
"draw a menu indicator if the item has a menu or delayed menu. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6187 |
" |
2220 | 6188 |
|x y icon bAbsLevel| |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6189 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6190 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6191 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6192 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6193 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6194 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6195 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6196 |
^ self |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6197 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6198 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6199 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6200 |
x := layout right - icon width. |
2220 | 6201 |
false "/ delayedMenuIndicatorVerticalPosition == #center |
6202 |
ifTrue:[ |
|
6203 |
y := layout height - icon height // 2 + layout top. |
|
6204 |
] ifFalse:[ |
|
6205 |
y := layout bottom - icon height - 2. |
|
6206 |
]. |
|
6207 |
||
6208 |
bAbsLevel := 0. |
|
2359 | 6209 |
menuItem isButton ifTrue:[ |
2220 | 6210 |
self isSelected ifTrue:[ |
6211 |
x := x + 1. |
|
6212 |
y := y + 1. |
|
6213 |
]. |
|
6214 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
6215 |
x := x - bAbsLevel. |
|
6216 |
y := y - bAbsLevel. |
|
6217 |
]. |
|
6218 |
x := x - 1 "- HorizontalInset". |
|
6219 |
||
6220 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
6221 |
icon := menuPanel lightenedImageOnDevice:icon |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6222 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6223 |
icon displayOn:menuPanel x:x y:y. |
2220 | 6224 |
|
2234 | 6225 |
(false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ]) |
2220 | 6226 |
ifTrue:[ |
6227 |
menuPanel paint:menuPanel buttonShadowColor. |
|
6228 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
6229 |
menuPanel paint:menuPanel buttonLightColor. |
|
6230 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
6231 |
]. |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6232 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6233 |
|
2059 | 6234 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6235 |
"draw a labeled entry; no button, no separator. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6236 |
" |
2059 | 6237 |
|mfont fontAscent |
1727 | 6238 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6239 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6240 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6241 |
| |
2059 | 6242 |
|
1727 | 6243 |
mfont := menuPanel setFont:font. |
2059 | 6244 |
fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6245 |
menuPanel paint:fg. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6246 |
|
2059 | 6247 |
y := layout top + (layout height - rawLabelExtent y // 2) + yOffset. |
2337 | 6248 |
"/ menuPanel centerItems ifTrue:[self halt]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6249 |
aLabel isArray ifFalse:[ |
2337 | 6250 |
aLabel isImageOrForm ifFalse:[ |
6251 |
y := y + fontAscent. |
|
6252 |
]. |
|
6253 |
aLabel displayOn:menuPanel x:x y:y. |
|
1727 | 6254 |
] ifTrue:[ |
2337 | 6255 |
aLabel do:[:el| |
6256 |
el notNil ifTrue:[ |
|
6257 |
el isImageOrForm ifFalse:[ |
|
6258 |
y0 := y + fontAscent |
|
6259 |
] ifTrue:[ |
|
6260 |
y0 := y |
|
6261 |
]. |
|
6262 |
x0 := x + (rawLabelExtent x - (el widthOn:menuPanel) // 2). |
|
6263 |
el displayOn:menuPanel x:x0 y:y0. |
|
6264 |
y := y + 1 + (el heightOn:menuPanel) |
|
6265 |
] ifFalse:[ |
|
6266 |
y := y + 3 "/ see #label: |
|
6267 |
] |
|
6268 |
]. |
|
1727 | 6269 |
]. |
6270 |
menuPanel setFont:mfont |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6271 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6272 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6273 |
drawSeparatingLines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6274 |
"draw separating lines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6275 |
" |
2059 | 6276 |
|myIndex lfSep rtSep items prevItem nextItem |
6277 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6278 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6279 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6280 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6281 |
b "{ Class:SmallInteger }" |
706 | 6282 |
| |
2059 | 6283 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6284 |
items := menuPanel items. |
2059 | 6285 |
myIndex := items identityIndexOf:self. |
6286 |
||
6287 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
6288 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
6289 |
||
6290 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
6291 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
6292 |
||
6293 |
(lfSep or:[rtSep]) ifFalse:[ |
|
2219 | 6294 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6295 |
]. |
2059 | 6296 |
|
6297 |
lightColor := menuPanel lightColor. |
|
6298 |
shadowColor := menuPanel shadowColor. |
|
6299 |
||
6300 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6301 |
|
608 | 6302 |
l := layout left. |
6303 |
t := layout top. |
|
6304 |
r := layout right. |
|
6305 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6306 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6307 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6308 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
6309 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
6310 |
||
6311 |
menuPanel paint:shadowColor. |
|
6312 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
6313 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-2 toX:r y:b-2]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6314 |
] ifFalse:[ |
2219 | 6315 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
6316 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
6317 |
||
6318 |
menuPanel paint:shadowColor. |
|
6319 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
6320 |
rtSep ifTrue:[menuPanel displayLineFromX:r-2 y:t toX:r-2 y:b]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6321 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6322 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6323 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6324 |
drawSeparator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6325 |
"draw as separator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6326 |
" |
2059 | 6327 |
|type lightColor shadowColor isDouble |
6328 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6329 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6330 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6331 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6332 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6333 |
| |
2059 | 6334 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6335 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6336 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
2219 | 6337 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6338 |
]. |
2059 | 6339 |
|
6340 |
isDouble := type == #doubleLine. |
|
6341 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6342 |
lightColor := menuPanel lightColor. |
2059 | 6343 |
shadowColor := menuPanel shadowColor. |
6344 |
menuPanel paint:shadowColor. |
|
6345 |
||
6346 |
left := layout left. |
|
6347 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6348 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6349 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6350 |
x0 := left + HorizontalInset. |
6351 |
x1 := layout right - HorizontalInset. |
|
6352 |
y0 := top - 1 + (layout height // 2). |
|
6353 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
6354 |
||
6355 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
6356 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
6357 |
||
6358 |
menuPanel paint:lightColor. |
|
6359 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
6360 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+5 toX:x1 y:y0+5]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6361 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6362 |
] ifFalse:[ |
2219 | 6363 |
y1 := layout bottom. |
6364 |
x0 := left - 1 + (layout width // 2). |
|
6365 |
y0 := top. |
|
6366 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
6367 |
||
6368 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
6369 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
6370 |
||
6371 |
menuPanel paint:lightColor. |
|
6372 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
6373 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+5 y:y0 toX:x0+5 y:y1]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6374 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6375 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6376 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6377 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6378 |
|
2362 | 6379 |
layout isNil ifTrue:[^ self]. |
6380 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6381 |
(rawLabel notNil and:[menuPanel notNil]) ifTrue:[ |
2362 | 6382 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6383 |
] |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6384 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6385 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6386 |
redraw |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6387 |
"redraw item |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6388 |
" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6389 |
|isSelected ownBgCol paint bgColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6390 |
x "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6391 |
y "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6392 |
w "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6393 |
h "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6394 |
| |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6395 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6396 |
self isVisible ifFalse:[^ self]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6397 |
|
2362 | 6398 |
self isSeparator ifTrue:[ |
6399 |
self drawSeparator. |
|
6400 |
^ self |
|
6401 |
]. |
|
6402 |
menuItem isButton ifTrue:[ |
|
6403 |
self drawButton. |
|
6404 |
^ self |
|
6405 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6406 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6407 |
"/ 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
|
6408 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6409 |
isSelected := self isSelected. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6410 |
bgColor := menuPanel backgroundColor. |
2170 | 6411 |
paint := isSelected |
2253 | 6412 |
ifTrue:[self activeBackgroundColor] |
6413 |
ifFalse:[ |
|
6414 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
|
6415 |
menuPanel enteredBackgroundColor |
|
6416 |
] ifFalse:[ |
|
6417 |
bgColor |
|
6418 |
]]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6419 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6420 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
2253 | 6421 |
paint := ownBgCol |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6422 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6423 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6424 |
paint ~= bgColor ifTrue:[ |
2253 | 6425 |
menuPanel paint:paint. |
6426 |
menuPanel fillRectangle:layout. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6427 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6428 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6429 |
menuPanel showSeparatingLines ifTrue:[ |
2253 | 6430 |
self drawSeparatingLines |
608 | 6431 |
]. |
6432 |
||
650 | 6433 |
self drawLabel. |
6434 |
||
1045 | 6435 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
2253 | 6436 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
6437 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
|
6438 |
||
6439 |
x := layout left. |
|
6440 |
y := layout top. |
|
6441 |
w := layout width. |
|
6442 |
h := layout height. |
|
6443 |
||
6444 |
menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2). |
|
6445 |
menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4). |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6446 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6447 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
388 | 6448 |
! ! |
6449 |
||
6450 |
!MenuPanel::Item methodsFor:'initialization'! |
|
6451 |
||
6452 |
destroy |
|
616 | 6453 |
"destroy submenus, remove dependencies |
388 | 6454 |
" |
616 | 6455 |
self submenu:nil. |
6456 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6457 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6458 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6459 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6460 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
616 | 6461 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6462 |
menuPanel := nil. |
616 | 6463 |
! |
6464 |
||
794 | 6465 |
in:aPanel |
6466 |
"create item in a menuPanel |
|
6467 |
" |
|
6468 |
menuPanel := aPanel. |
|
2359 | 6469 |
|
6470 |
menuItem isNil ifTrue:[ |
|
6471 |
self halt. |
|
6472 |
menuItem := MenuItem new |
|
6473 |
]. |
|
6474 |
! |
|
6475 |
||
6476 |
initialize |
|
6477 |
menuItem := MenuItem new. |
|
1811 | 6478 |
! |
6479 |
||
6480 |
reinitStyle |
|
6481 |
||
6482 |
subMenu notNil ifTrue:[ |
|
2219 | 6483 |
subMenu reinitStyle |
1811 | 6484 |
]. |
6485 |
||
6486 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
6487 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 6488 |
! ! |
6489 |
||
6490 |
!MenuPanel::Item methodsFor:'label basics'! |
|
6491 |
||
6492 |
disabledRawLabel |
|
6493 |
"returns the label used if the item is disabled |
|
6494 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6495 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6496 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6497 |
disabledRawLabel notNil ifTrue:[^ disabledRawLabel]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6498 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6499 |
disabledRawLabel := rawLabel ? ''. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6500 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6501 |
disabledRawLabel isString ifTrue:[ |
2219 | 6502 |
^ disabledRawLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6503 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6504 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6505 |
block := [:el| |rslt| |
2219 | 6506 |
(rslt := el) notNil ifTrue:[ |
6507 |
el isImageOrForm ifTrue:[ |
|
6508 |
el colorMap notNil ifTrue:[ |
|
6509 |
rslt := menuPanel lightenedImageOnDevice:el |
|
6510 |
] |
|
6511 |
] ifFalse:[ |
|
6512 |
el class == LabelAndIcon ifTrue:[ |
|
6513 |
((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[ |
|
6514 |
form := menuPanel lightenedImageOnDevice:form |
|
6515 |
]. |
|
6516 |
((image := el image) notNil and:[image colorMap notNil]) ifTrue:[ |
|
6517 |
image := menuPanel lightenedImageOnDevice:image |
|
6518 |
]. |
|
6519 |
rslt := LabelAndIcon form:form image:image string:(el string). |
|
6520 |
] |
|
6521 |
] |
|
6522 |
]. |
|
6523 |
rslt |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6524 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6525 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6526 |
rawLabel isArray ifTrue:[ |
2219 | 6527 |
disabledRawLabel := Array new:(rawLabel size). |
6528 |
||
6529 |
rawLabel keysAndValuesDo:[:anIndex :aLabel| |
|
6530 |
disabledRawLabel at:anIndex put:(block value:aLabel) |
|
6531 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6532 |
] ifFalse:[ |
2219 | 6533 |
disabledRawLabel := block value:rawLabel |
794 | 6534 |
]. |
6535 |
^ disabledRawLabel |
|
6536 |
! |
|
6537 |
||
1829 | 6538 |
fetchDeviceResources |
6539 |
disabledRawLabel := nil. |
|
6540 |
self fetchImages. |
|
6541 |
||
6542 |
font notNil ifTrue:[ |
|
2219 | 6543 |
font := font onDevice:(menuPanel device) |
1829 | 6544 |
]. |
6545 |
! |
|
6546 |
||
616 | 6547 |
fetchImages |
6548 |
"fetch images |
|
6549 |
" |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6550 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6551 |
|
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6552 |
(rawLabel isNil or:[rawLabel isString]) ifTrue:[ |
2219 | 6553 |
^ self |
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6554 |
]. |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6555 |
rawLabel isImageOrForm ifTrue:[ |
2219 | 6556 |
rawLabel := menuPanel imageOnDevice:rawLabel. |
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6557 |
^ self. |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6558 |
]. |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6559 |
|
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6560 |
rawLabel class == LabelAndIcon ifTrue:[ |
2219 | 6561 |
(icon := rawLabel image) notNil ifTrue:[ |
6562 |
rawLabel image:(menuPanel imageOnDevice:icon) |
|
6563 |
]. |
|
6564 |
(icon := rawLabel icon) notNil ifTrue:[ |
|
6565 |
rawLabel icon:(menuPanel imageOnDevice:icon) |
|
6566 |
]. |
|
6567 |
^ self |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6568 |
]. |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6569 |
|
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6570 |
rawLabel isArray ifFalse:[^ self]. |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6571 |
|
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6572 |
rawLabel keysAndValuesDo:[:i :el| |
2219 | 6573 |
(el notNil and:[el isString not]) ifTrue:[ |
6574 |
el isImageOrForm ifTrue:[ |
|
6575 |
rawLabel at:i put:(menuPanel imageOnDevice:el). |
|
6576 |
] ifFalse:[ |
|
6577 |
el class == LabelAndIcon ifTrue:[ |
|
6578 |
(icon := el image) notNil ifTrue:[ |
|
6579 |
el image:(menuPanel imageOnDevice:icon) |
|
6580 |
]. |
|
6581 |
(icon := el icon) notNil ifTrue:[ |
|
6582 |
el icon:(menuPanel imageOnDevice:icon) |
|
6583 |
] |
|
6584 |
] |
|
6585 |
] |
|
6586 |
] |
|
1078 | 6587 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6588 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6589 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6590 |
updateAccessCharacterFor:aLabel |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6591 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6592 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6593 |
(accessCharacter notNil or:[aLabel isNil]) ifTrue:[ |
2359 | 6594 |
^ aLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6595 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6596 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6597 |
aLabel isString ifFalse:[ |
2359 | 6598 |
aLabel class == LabelAndIcon ifTrue:[ |
6599 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
|
6600 |
]. |
|
6601 |
^ aLabel |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6602 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6603 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6604 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6605 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6606 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6607 |
label := aLabel. |
2359 | 6608 |
pos := menuItem accessCharacterPosition. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6609 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6610 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
2359 | 6611 |
rest := label copyFrom:(i+1). |
6612 |
||
6613 |
i == 1 ifTrue:[label := rest] |
|
6614 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
6615 |
||
6616 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
|
6617 |
s := s - 1. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6618 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6619 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6620 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
2359 | 6621 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6622 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6623 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6624 |
label isText ifFalse:[ |
2359 | 6625 |
label := Text string:label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6626 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6627 |
label emphasisAt:pos add:#underline. |
2359 | 6628 |
^ label |
388 | 6629 |
! ! |
6630 |
||
1573 | 6631 |
!MenuPanel::Item methodsFor:'printing & storing'! |
6632 |
||
6633 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6634 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6635 |
|
1573 | 6636 |
! ! |
6637 |
||
388 | 6638 |
!MenuPanel::Item methodsFor:'private'! |
6639 |
||
650 | 6640 |
activeBackgroundColor |
6641 |
"returns the active background color derived from menuPanel |
|
6642 |
" |
|
2359 | 6643 |
menuItem isButton ifTrue:[ |
6644 |
^ menuPanel buttonActiveBackgroundColor |
|
6645 |
]. |
|
6646 |
^ menuPanel activeBackgroundColor |
|
650 | 6647 |
! |
6648 |
||
6649 |
activeForegroundColor |
|
6650 |
"returns the active foreground color derived from menuPanel |
|
6651 |
" |
|
6652 |
||
6653 |
^menuPanel activeForegroundColor |
|
6654 |
! |
|
6655 |
||
727 | 6656 |
backgroundColor |
6657 |
"returns the background color derived from menuPanel |
|
6658 |
" |
|
2359 | 6659 |
menuItem isButton ifTrue:[ |
6660 |
^ menuPanel buttonPassiveBackgroundColor |
|
6661 |
]. |
|
6662 |
^ menuPanel backgroundColor |
|
727 | 6663 |
! |
6664 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6665 |
backgroundColorFromLabel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6666 |
"returns the background color derived from label or nil |
388 | 6667 |
" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6668 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6669 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6670 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6671 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6672 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6673 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6674 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6675 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6676 |
run size == 0 ifTrue:[ |
2145 | 6677 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
6678 |
^ run value |
|
6679 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6680 |
] ifFalse:[ |
2145 | 6681 |
run do:[:r| |
6682 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
6683 |
^ r value |
|
6684 |
] |
|
6685 |
] |
|
388 | 6686 |
]. |
6687 |
^ nil |
|
6688 |
! |
|
6689 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6690 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6691 |
"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
|
6692 |
derived from menuPanel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6693 |
" |
2359 | 6694 |
menuItem isButton ifTrue:[ |
6695 |
^ menuPanel buttonEnteredBackgroundColor |
|
6696 |
]. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6697 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6698 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6699 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6700 |
choiceForm |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6701 |
"returns choice form or nil |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6702 |
" |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6703 |
|isOn| |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6704 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6705 |
choice isNil ifTrue:[^ nil]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6706 |
|
2359 | 6707 |
isOn := (choice value = menuItem choiceValue). |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6708 |
self enabled ifFalse:[ |
2359 | 6709 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
6710 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6711 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6712 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
2359 | 6713 |
ifFalse:[menuPanel iconRadioGroupOff] |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6714 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6715 |
|
663 | 6716 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6717 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6718 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6719 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6720 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6721 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6722 |
|subm sel numArgs| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6723 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6724 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6725 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6726 |
sel := menuItem submenuChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6727 |
sel isString ifFalse:[^ nil]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6728 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6729 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6730 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6731 |
numArgs == 0 ifTrue:[ |
2359 | 6732 |
MessageNotUnderstood handle:[:ex | |
6733 |
|selector| |
|
6734 |
||
6735 |
((selector := ex message selector) == sel |
|
6736 |
or:[selector == #aspectFor:]) ifFalse:[ |
|
6737 |
ex reject |
|
6738 |
]. |
|
6739 |
] do:[ |
|
6740 |
subm := aRecv aspectFor:sel. |
|
6741 |
]. |
|
6742 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6743 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6744 |
|
2043 | 6745 |
(Array with:(aRecv) with:(aRecv class)) |
6746 |
do:[:aPossibleReceiver | |
|
2359 | 6747 |
MessageNotUnderstood handle:[:ex| |
6748 |
ex message selector == sel ifFalse:[ ex reject ] |
|
6749 |
] do:[ |
|
6750 |
numArgs == 0 ifTrue:[ |
|
6751 |
subm := aPossibleReceiver perform:sel |
|
6752 |
] ifFalse:[ |
|
6753 |
numArgs == 1 ifTrue:[ |
|
6754 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
|
6755 |
] ifFalse:[ |
|
6756 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
|
6757 |
] |
|
6758 |
] |
|
6759 |
]. |
|
6760 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6761 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6762 |
|
663 | 6763 |
^ subm |
2043 | 6764 |
|
6765 |
"Modified: / 30.10.2001 / 13:28:25 / cg" |
|
663 | 6766 |
! |
6767 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6768 |
indicationValue |
524 | 6769 |
"returns indication value or nil in case of no indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6770 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6771 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6772 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6773 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6774 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6775 |
indication isSymbol ifFalse:[ |
2359 | 6776 |
^ indication value == true "block or model" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6777 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6778 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6779 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
2359 | 6780 |
recv := menuPanel receiver. |
6781 |
||
6782 |
(recv isValueModel) ifFalse:[ |
|
6783 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
6784 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
6785 |
sel := sel asSymbol. |
|
6786 |
||
6787 |
MessageNotUnderstood handle:[:ex| |
|
6788 |
ex message selector == sel ifFalse:[ |
|
6789 |
ex reject |
|
6790 |
]. |
|
6791 |
] do:[ |
|
6792 |
sel := recv perform:sel with:(menuItem argument) |
|
6793 |
] |
|
6794 |
]. |
|
6795 |
]. |
|
6796 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6797 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6798 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6799 |
numArgs ~~ 0 ifTrue:[ |
2359 | 6800 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6801 |
] ifFalse:[ |
2359 | 6802 |
sel := indication |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6803 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6804 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6805 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6806 |
sel isValueModel ifTrue:[ |
2359 | 6807 |
indication := sel. |
6808 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6809 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6810 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6811 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6812 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6813 |
indicationValue:aValue |
1218 | 6814 |
"set the indication value |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6815 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6816 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6817 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6818 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6819 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6820 |
indication isSymbol ifFalse:[ |
2359 | 6821 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
6822 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6823 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6824 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6825 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
2359 | 6826 |
^ self |
1218 | 6827 |
]. |
6828 |
||
524 | 6829 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6830 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6831 |
|
1218 | 6832 |
recv isNil ifTrue:[ |
2359 | 6833 |
recv := menuPanel application. |
6834 |
recv isNil ifTrue:[^ self]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6835 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6836 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6837 |
MessageNotUnderstood handle:[:ex| |
2359 | 6838 |
(ex message selector ~~ indication) ifTrue:[ |
6839 |
ex reject |
|
6840 |
]. |
|
6841 |
self ifNotInUIBuilderInfoPrintCR: |
|
6842 |
('MenuPanel::Item [info]: application does not respond to ' , indication). |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6843 |
] do:[ |
2359 | 6844 |
numArgs == 1 ifTrue:[ |
6845 |
recv perform:indication with:aValue |
|
6846 |
] ifFalse:[ |
|
6847 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
6848 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6849 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6850 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6851 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6852 |
indicatorForm |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6853 |
"returns indication form or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6854 |
" |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6855 |
|val| |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6856 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6857 |
indication isNil ifTrue:[^ nil]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6858 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6859 |
val := self indicationValue. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6860 |
self enabled ifFalse:[ |
2219 | 6861 |
^ val == true |
6862 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
6863 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6864 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6865 |
^ val == true |
2219 | 6866 |
ifTrue:[menuPanel iconIndicationOn] |
6867 |
ifFalse:[menuPanel iconIndicationOff] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6868 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6869 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6870 |
isEntered |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6871 |
"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
|
6872 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6873 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6874 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6875 |
"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
|
6876 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6877 |
|
464 | 6878 |
separatorType |
6879 |
"returns type of separator line or nil |
|
388 | 6880 |
" |
390 | 6881 |
|c lbl| |
388 | 6882 |
|
6883 |
rawLabel isNil ifFalse:[ |
|
2145 | 6884 |
^ nil |
388 | 6885 |
]. |
6886 |
||
390 | 6887 |
(lbl := label value) isNil ifTrue:[ |
2145 | 6888 |
^ #singleLine |
388 | 6889 |
]. |
6890 |
||
390 | 6891 |
lbl size == 1 ifTrue:[ |
2145 | 6892 |
c := lbl first. |
6893 |
c == $- ifTrue:[^ #singleLine]. |
|
6894 |
c == $= ifTrue:[^ #doubleLine]. |
|
388 | 6895 |
]. |
6896 |
^ #blankLine |
|
1130 | 6897 |
! |
6898 |
||
6899 |
setupSubmenu |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6900 |
|appl master recv submenuHolder submenu submenuEncoding channel| |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6901 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6902 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6903 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6904 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6905 |
subMenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6906 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6907 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6908 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6909 |
channel isSymbol ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6910 |
submenuHolder := channel |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6911 |
] ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6912 |
appl := menuPanel application. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6913 |
appl isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6914 |
appl := menuPanel receiver. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6915 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6916 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6917 |
[submenuHolder isNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6918 |
and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6919 |
and:[master ~~ appl]]] whileTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6920 |
appl := master. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6921 |
submenuHolder := self findSubMenuIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6922 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6923 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
6924 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6925 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6926 |
submenuHolder isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6927 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6928 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6929 |
appl := recv. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6930 |
submenuHolder := self findSubMenuIn:appl |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
6931 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
6932 |
] |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6933 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6934 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6935 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6936 |
(submenu := submenuHolder value) isArray ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6937 |
submenuEncoding := submenu. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6938 |
submenu := Menu new fromLiteralArrayEncoding:submenuEncoding. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6939 |
"/ cg: linked menus also may contain translations ... |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6940 |
submenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6941 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6942 |
submenu findGuiResourcesIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6943 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
6944 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6945 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6946 |
"/ appl notNil ifTrue:[submenu application:appl]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6947 |
self submenu:submenu. |
1130 | 6948 |
^ subMenu |
6949 |
||
6950 |
"Modified: / 19.5.1998 / 19:36:56 / cg" |
|
388 | 6951 |
! ! |
6952 |
||
6953 |
!MenuPanel::Item methodsFor:'queries'! |
|
6954 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
6955 |
canChangeVisibility |
1699 | 6956 |
"return true if I am not always visible; can only be changed by a selector |
6957 |
otherwise there is a change notification raised if the model changed |
|
6958 |
" |
|
6959 |
^ isVisible isSymbol |
|
6960 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
6961 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
6962 |
|
388 | 6963 |
canSelect |
1699 | 6964 |
"returns true if item is selectable; no separator, visible and enabled. |
6965 |
in case of a choice (RadioButton) i have to check for the choiceValue |
|
388 | 6966 |
" |
2362 | 6967 |
self isSeparator ifTrue:[^ false]. |
6968 |
||
6969 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
2359 | 6970 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
6971 |
^ true |
|
6972 |
]. |
|
1078 | 6973 |
]. |
6974 |
^ false |
|
388 | 6975 |
! |
6976 |
||
2046 | 6977 |
containsPoint:aPoint |
6978 |
"returns true if aPoint is contained in my layout |
|
6979 |
" |
|
6980 |
(self isVisible and:[layout notNil]) ifTrue:[ |
|
2219 | 6981 |
^ layout containsPoint:aPoint |
2046 | 6982 |
]. |
6983 |
^ false |
|
6984 |
||
6985 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
6986 |
! |
|
6987 |
||
388 | 6988 |
containsPointX:x y:y |
6989 |
"returns true if point is contained in my layout |
|
6990 |
" |
|
712 | 6991 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2219 | 6992 |
^ layout containsPointX:x y:y |
505 | 6993 |
]. |
6994 |
^ false |
|
388 | 6995 |
! |
6996 |
||
2199 | 6997 |
hasDelayedMenu |
6998 |
"returns true if a delayed menu exists |
|
6999 |
" |
|
2360 | 7000 |
self hasSubmenu ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7001 |
^ false |
2199 | 7002 |
]. |
2360 | 7003 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
7004 |
||
7005 |
(indication isNil and:[choice isNil]) ifTrue:[ |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7006 |
^ false |
2199 | 7007 |
]. |
7008 |
^ true |
|
7009 |
! |
|
7010 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7011 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7012 |
"returns true if the item has a delayed menu |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7013 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews) |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7014 |
" |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7015 |
menuPanel isPopUpView ifFalse:[ |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7016 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7017 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7018 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7019 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7020 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7021 |
hasIndication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7022 |
"returns true if on/off indication exists |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7023 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7024 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7025 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7026 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7027 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7028 |
"returns true if the item has a delayed menu |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7029 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews) |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7030 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7031 |
menuPanel isPopUpView ifFalse:[ |
2360 | 7032 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7033 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7034 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7035 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7036 |
|
388 | 7037 |
hasSubmenu |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7038 |
"returns true if the item is configured as an subMenu entry |
388 | 7039 |
" |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7040 |
^ subMenu notNil or:[menuItem submenuChannel notNil] |
388 | 7041 |
! |
7042 |
||
7043 |
isEnabled |
|
7044 |
"returns enabled state |
|
7045 |
" |
|
7046 |
^ self enabled |
|
7047 |
! |
|
7048 |
||
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
7049 |
isLabeledItem |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
7050 |
"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
|
7051 |
" |
2359 | 7052 |
^ rawLabel notNil and:[menuItem isButton not] |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
7053 |
! |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
7054 |
|
608 | 7055 |
isSeparator |
7056 |
"returns true if item is a separator |
|
7057 |
" |
|
7058 |
^ rawLabel isNil |
|
7059 |
! |
|
7060 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7061 |
isToggle |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7062 |
"returns true if on/off indication exists |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7063 |
" |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7064 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7065 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7066 |
|
712 | 7067 |
isVisible |
7068 |
"returns the visibility state |
|
7069 |
" |
|
7070 |
|state| |
|
7071 |
||
7072 |
isVisible isSymbol ifTrue:[ |
|
2219 | 7073 |
state := self aspectAt:isVisible. |
7074 |
||
7075 |
state isValueModel ifTrue:[ |
|
7076 |
isVisible := state. |
|
7077 |
isVisible addDependent:self. |
|
7078 |
state := isVisible. |
|
7079 |
] |
|
712 | 7080 |
] ifFalse:[ |
2219 | 7081 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7082 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7083 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7084 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7085 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 7086 |
! |
7087 |
||
7088 |
isVisible:something |
|
7089 |
"change the state; if the state changed, a redraw is performed |
|
7090 |
" |
|
7091 |
|oldState newState| |
|
7092 |
||
7093 |
isVisible isNil ifTrue:[ |
|
2219 | 7094 |
oldState := true |
712 | 7095 |
] ifFalse:[ |
2219 | 7096 |
oldState := isVisible value. |
7097 |
isVisible isValueModel ifTrue:[ |
|
7098 |
isVisible removeDependent:self |
|
7099 |
] |
|
712 | 7100 |
]. |
7101 |
isVisible := something. |
|
7102 |
||
7103 |
isVisible isNil ifTrue:[ |
|
2219 | 7104 |
newState := true |
712 | 7105 |
] ifFalse:[ |
2219 | 7106 |
isVisible isValueModel ifTrue:[ |
7107 |
isVisible addDependent:self |
|
7108 |
] ifFalse:[ |
|
7109 |
isVisible isSymbol ifTrue:[^ self] |
|
7110 |
]. |
|
7111 |
menuPanel shown ifFalse:[^ self]. |
|
7112 |
newState := isVisible value. |
|
712 | 7113 |
]. |
7114 |
||
7115 |
newState ~~ oldState ifTrue:[ |
|
2219 | 7116 |
menuPanel mustRearrange |
712 | 7117 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7118 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7119 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 7120 |
! |
7121 |
||
388 | 7122 |
shortcutKeyAsString |
7123 |
"converts shortcutKey to a text object |
|
7124 |
" |
|
2359 | 7125 |
|nm prefix shortcutKey| |
7126 |
||
7127 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 7128 |
|
7129 |
shortcutKey isNil ifTrue:[ |
|
2359 | 7130 |
^ nil |
1609 | 7131 |
]. |
7132 |
||
7133 |
shortcutKey isCharacter ifTrue:[ |
|
2359 | 7134 |
nm := shortcutKey asString |
388 | 7135 |
] ifFalse:[ |
2359 | 7136 |
"/ this is somewhat complicated: we have the symbolic key at hand, |
7137 |
"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
|
7138 |
"/ Ask the devices keyboardMap for the backtranslation. |
|
7139 |
||
7140 |
nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey. |
|
7141 |
"/ |
|
7142 |
"/ some modifier-key combination ? |
|
7143 |
"/ |
|
7144 |
(nm startsWith:#Cmd) ifTrue:[ |
|
7145 |
prefix := #Cmd. |
|
7146 |
] ifFalse:[(nm startsWith:#Alt) ifTrue:[ |
|
7147 |
prefix := #Alt. |
|
7148 |
] ifFalse:[(nm startsWith:#Meta) ifTrue:[ |
|
7149 |
prefix := #Meta. |
|
7150 |
] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[ |
|
7151 |
prefix := #Ctrl. |
|
7152 |
]]]]. |
|
7153 |
prefix notNil ifTrue:[ |
|
7154 |
nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1)) |
|
7155 |
] ifFalse:[ |
|
7156 |
nm := nm asString |
|
7157 |
] |
|
388 | 7158 |
]. |
608 | 7159 |
^ nm |
388 | 7160 |
|
987 | 7161 |
"Modified: / 17.7.1998 / 11:56:40 / cg" |
388 | 7162 |
! |
7163 |
||
7164 |
shortcutKeyPrefixFor:aModifier |
|
7165 |
"returns prefix assigned to a modifier |
|
7166 |
" |
|
7167 |
|m| |
|
7168 |
||
7169 |
m := menuPanel device modifierKeyTopFor:aModifier. |
|
7170 |
m notNil ifTrue:[ |
|
2145 | 7171 |
^ m , '-' |
388 | 7172 |
]. |
987 | 7173 |
^ aModifier , '-'. |
7174 |
||
7175 |
"Modified: / 17.7.1998 / 11:56:46 / cg" |
|
388 | 7176 |
! ! |
7177 |
||
7178 |
!MenuPanel::Item methodsFor:'selection'! |
|
7179 |
||
7180 |
isSelected |
|
7181 |
"returns true if item is selected |
|
7182 |
" |
|
1998 | 7183 |
|
7184 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 7185 |
! |
7186 |
||
2249 | 7187 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7188 |
"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
|
7189 |
submenu and perform a redraw |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7190 |
" |
2249 | 7191 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
7192 |
self invalidate. |
|
7193 |
self hideSubmenu. |
|
2359 | 7194 |
^ self |
2249 | 7195 |
]. |
7196 |
||
2199 | 7197 |
menuPanel realized ifFalse:[ ^ self ]. |
7198 |
||
2359 | 7199 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
2249 | 7200 |
self invalidate |
2199 | 7201 |
]. |
7202 |
self hasSubmenu ifFalse:[ ^ self]. |
|
7203 |
||
7204 |
self hasDelayedMenu ifTrue:[ |
|
2249 | 7205 |
menuPanel openDelayed:self |
2199 | 7206 |
] ifFalse:[ |
2249 | 7207 |
subMenu := self setupSubmenu. |
7208 |
subMenu ifNotNil:[ self openSubmenu ]. |
|
1701 | 7209 |
]. |
388 | 7210 |
! ! |
7211 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7212 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 7213 |
|
2018 | 7214 |
icon |
2016 | 7215 |
"This resource specification was automatically generated |
7216 |
by the ImageEditor of ST/X." |
|
7217 |
||
7218 |
"Do not manually edit this!! If it is corrupted, |
|
7219 |
the ImageEditor may not be able to read the specification." |
|
7220 |
||
7221 |
" |
|
2018 | 7222 |
self icon inspect |
7223 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 7224 |
" |
7225 |
||
7226 |
<resource: #image> |
|
7227 |
||
7228 |
^Icon |
|
2219 | 7229 |
constantNamed:#'MenuPanel::Scrolling class icon' |
7230 |
ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a') ; yourself); yourself] |
|
2016 | 7231 |
! ! |
7232 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7233 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 7234 |
|
7235 |
new |
|
7236 |
^ self basicNew initialize |
|
7237 |
! ! |
|
7238 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7239 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 7240 |
|
7241 |
activeMenu |
|
7242 |
"returns the active menu the scrolling is activated on; nil |
|
7243 |
is returned if scrolling is deactivated |
|
7244 |
" |
|
7245 |
^ activeMenu |
|
7246 |
! |
|
7247 |
||
7248 |
direction |
|
7249 |
"returns the scroll-direction |
|
7250 |
" |
|
7251 |
^ direction |
|
7252 |
! |
|
7253 |
||
7254 |
iconAt:aDirection on:aMenu |
|
2018 | 7255 |
|icon device index| |
2016 | 7256 |
|
7257 |
device := aMenu device. |
|
7258 |
||
7259 |
aDirection == #PREV ifTrue:[ |
|
2219 | 7260 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
7261 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 7262 |
] ifFalse:[ |
2219 | 7263 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
7264 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 7265 |
]. |
7266 |
||
7267 |
icon := icons at:index. |
|
7268 |
||
7269 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
2219 | 7270 |
icon := self class icon. |
7271 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
7272 |
ifFalse:[ icon := icon copy ]. |
|
7273 |
||
7274 |
icon := icon onDevice:device. |
|
7275 |
icon clearMaskedPixels. |
|
7276 |
icons at:index put:icon |
|
2018 | 7277 |
]. |
7278 |
^ icon |
|
2016 | 7279 |
! ! |
7280 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7281 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 7282 |
|
7283 |
initialize |
|
7284 |
||
7285 |
semaLock := RecursionLock new. |
|
2018 | 7286 |
icons := Array new:4. |
2016 | 7287 |
! ! |
7288 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7289 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 7290 |
|
7291 |
isActive |
|
7292 |
"returns true if scrolling is activated |
|
7293 |
" |
|
7294 |
^ activeMenu notNil |
|
7295 |
! ! |
|
7296 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7297 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 7298 |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7299 |
startIfRequiredAt:aDirection on:aMenu |
2016 | 7300 |
"start scrolling; returns true if scrolling is activated |
7301 |
" |
|
7302 |
|bounds index| |
|
7303 |
||
7304 |
semaLock critical:[ |
|
2219 | 7305 |
self stop. |
7306 |
||
7307 |
( aDirection notNil |
|
7308 |
and:[aMenu notNil |
|
7309 |
and:[(bounds := aMenu scrollerBoundsAt:aDirection) notNil]] |
|
7310 |
) ifTrue:[ |
|
7311 |
activeMenu := aMenu. |
|
7312 |
direction := aDirection. |
|
7313 |
||
7314 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
7315 |
||
7316 |
index ~~ 0 ifTrue:[ |
|
7317 |
scrollTask := |
|
7318 |
[ |
|
7319 |
|item step| |
|
7320 |
||
7321 |
[ |
|
7322 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
7323 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
7324 |
aMenu makeItemVisible:item. |
|
7325 |
index := index + step. |
|
7326 |
]. |
|
7327 |
||
7328 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
7329 |
||
7330 |
[ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[ |
|
7331 |
aMenu makeItemVisible:item. |
|
7332 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
7333 |
index := index + step. |
|
7334 |
]. |
|
7335 |
item := nil. |
|
7336 |
] ensure:[ |
|
7337 |
scrollTask := nil. |
|
7338 |
||
7339 |
item notNil ifTrue:[ |
|
7340 |
"/ process was killed |
|
7341 |
aMenu invalidate:bounds |
|
7342 |
] |
|
7343 |
] |
|
7344 |
] forkAt:8. |
|
7345 |
] |
|
7346 |
] |
|
2016 | 7347 |
]. |
7348 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7349 |
|
2048 | 7350 |
"Created: ca" |
7351 |
||
7352 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 7353 |
! |
7354 |
||
7355 |
stop |
|
7356 |
"stop scrolling; returns true if the scrolling was activated otherwise false |
|
7357 |
" |
|
7358 |
|task resp| |
|
7359 |
||
7360 |
activeMenu isNil ifTrue:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7361 |
^ false |
2016 | 7362 |
]. |
7363 |
semaLock critical:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7364 |
resp := activeMenu notNil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7365 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7366 |
(task := scrollTask) notNil ifTrue:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7367 |
scrollTask := nil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7368 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7369 |
Error handle:[:ex| |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7370 |
] do:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7371 |
task terminateWithAllSubprocessesInGroup. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7372 |
task waitUntilTerminated. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7373 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7374 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7375 |
activeMenu := direction := nil. |
2016 | 7376 |
]. |
7377 |
^ resp |
|
7378 |
! ! |
|
7379 |
||
388 | 7380 |
!MenuPanel class methodsFor:'documentation'! |
7381 |
||
7382 |
version |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7383 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.353 2002-11-11 10:29:41 ca Exp $' |
388 | 7384 |
! ! |
2199 | 7385 |
|
388 | 7386 |
MenuPanel initialize! |