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