author | Claus Gittinger <cg@exept.de> |
Wed, 12 Jun 1996 14:55:00 +0200 | |
changeset 760 | 62824e1f2607 |
parent 750 | 94db70fea830 |
child 763 | 7af3f1baf479 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
||
542 | 13 |
View subclass:#PullDownMenu |
283 | 14 |
instanceVariableNames:'receiver menus titles selectors activeMenuNumber |
250
77012e65ac84
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
15 |
showSeparatingLines topMargin fgColor bgColor activeFgColor |
77012e65ac84
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
16 |
activeBgColor onLevel offLevel edgeStyle keepMenu toggleKeep |
542 | 17 |
raiseTopWhenActivated actions' |
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
18 |
classVariableNames:'DefaultViewBackground DefaultForegroundColor |
250
77012e65ac84
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
19 |
DefaultBackgroundColor DefaultHilightForegroundColor |
77012e65ac84
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
20 |
DefaultHilightBackgroundColor DefaultLevel DefaultHilightLevel |
77012e65ac84
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
21 |
DefaultShadowColor DefaultLightColor DefaultEdgeStyle |
77012e65ac84
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
22 |
DefaultKeepMenu DefaultToggleKeep DefaultSeparatingLines' |
283 | 23 |
poolDictionaries:'' |
24 |
category:'Views-Menus' |
|
0 | 25 |
! |
26 |
||
3 | 27 |
!PullDownMenu class methodsFor:'documentation'! |
28 |
||
38 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 32 |
All Rights Reserved |
38 | 33 |
|
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
3 | 43 |
documentation |
44 |
" |
|
38 | 45 |
PullDown menu provides the top (always visible) part of these menus. |
46 |
It controls display of its menus, which become visible when one of the |
|
47 |
PullDownMenus entries is pressed. |
|
0 | 48 |
|
128 | 49 |
A PullDownMenu itself consists of a single row of labels, which activate |
50 |
a pulled menu when clicked. Entries may be empty (i.e. have no menu) |
|
51 |
and empty entries may (optionally) also perform some action when clicked. |
|
52 |
An entries selector is used as the key to define and access submenus |
|
53 |
and (for empty entries:) the selector sent to the receiver of the menu. |
|
54 |
||
586 | 55 |
[Instance variables:] |
0 | 56 |
|
128 | 57 |
menus <Collection> the sub menus |
58 |
||
59 |
titles <Collection> the strings in the menu |
|
60 |
||
61 |
selectors <Collection> the selectors to send to the menu- |
|
586 | 62 |
receiver (for empty pull-menus) |
63 |
if nil (the default), title entries |
|
64 |
do not send anything. |
|
128 | 65 |
|
110 | 66 |
activeMenuNumber <Number> the index of the currently active menu |
128 | 67 |
|
110 | 68 |
showSeparatingLines <Boolean> show separating lines between my menu-strings |
128 | 69 |
|
110 | 70 |
topMargin <Number> number of pixels at top |
128 | 71 |
|
72 |
fgColor <Color> fg color to draw passive menu-titles |
|
73 |
bgColor <Color> bg color to draw passive menu-titles |
|
74 |
||
75 |
activeFgColor <Color> fg color to draw activated menu-titles |
|
76 |
activeBgColor <Color> bg color to draw activated menu-titles |
|
77 |
||
78 |
onLevel <Integer> 3D level of entry-buttons when pressed |
|
79 |
offLevel <Integer> 3D level of entry-buttons when released |
|
80 |
||
81 |
edgeStyle <Symbol> how to draw edges |
|
82 |
||
110 | 83 |
keepmenu <Boolean> if on, pulled menu stays on click, |
586 | 84 |
till clicked again (motif & windows behavior) |
77 | 85 |
|
128 | 86 |
toggleKeep <Boolean> if on and keepMenu is on, |
586 | 87 |
clicking again on label closes menu |
128 | 88 |
|
89 |
except menus, titles and selectors, instvars are usually defined from |
|
90 |
defaults in the styleSheet; you should not care for them. |
|
91 |
||
77 | 92 |
|
586 | 93 |
[StyleSheet values:] |
77 | 94 |
|
110 | 95 |
pullDownMenuViewBackground view background Color for the menu bar |
586 | 96 |
default: menuViewBackground |
110 | 97 |
|
98 |
pullDownMenuForegroundColor foreground drawing color for the menu bar |
|
586 | 99 |
default: menuForegroundColor |
110 | 100 |
|
101 |
pullDownMenuBackgroundColor background drawing color for the menu bar |
|
586 | 102 |
default: menuBackgroundColor |
110 | 103 |
|
104 |
pullDownMenuHilightForegroundColor active foreground drawing color for the menu bar |
|
586 | 105 |
default: menuHilightForegroundColor |
110 | 106 |
|
107 |
pullDownMenuHilightBackgroundColor active background drawing color for the menu bar |
|
586 | 108 |
default: menuHilightBackgroundColor |
110 | 109 |
|
110 |
pullDownMenuHilightLevel level (3D only) when active |
|
586 | 111 |
default: menuHilightLevel |
77 | 112 |
|
110 | 113 |
pullDownMenuEdgeStyle edge style (nil or #soft) |
114 |
||
115 |
pullDownMenuKeepMenu if true, pulled menu stays open until button |
|
586 | 116 |
is pressed again outside of the item-area (motif behavior) |
117 |
if false, menu closes on release (default) |
|
110 | 118 |
|
119 |
pullDownMenuToggleKeep if true, pulled menu closes when an entry is pressed |
|
586 | 120 |
again. Otherwise, only press outside of the items area |
121 |
hides it. default is false |
|
110 | 122 |
|
123 |
pullDownMenuLevel level (3D only) |
|
124 |
||
125 |
pullDownMenuFont font to use for the menu bar |
|
586 | 126 |
default: menuFont |
128 | 127 |
|
128 |
pullDownMenuShowSeparatingLines if true, lines are drawn between items. |
|
586 | 129 |
default: false |
133 | 130 |
|
131 |
pullDownMenuRaiseTop if true, topview is raised whenever an entry |
|
586 | 132 |
is activated. |
133 |
default: true |
|
134 |
||
135 |
[author:] |
|
136 |
Claus Gittinger |
|
110 | 137 |
" |
138 |
! |
|
77 | 139 |
|
110 | 140 |
examples |
141 |
" |
|
593 | 142 |
[exBegin] |
143 |
|top menu| |
|
128 | 144 |
|
593 | 145 |
top := StandardSystemView new. |
146 |
top extent:300@300. |
|
128 | 147 |
|
593 | 148 |
menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
149 |
menu labels:#('foo' 'bar'). |
|
150 |
menu selectors:#(foo bar). |
|
151 |
menu at:#foo |
|
152 |
putLabels:#('foo1' 'foo2' 'foo3') |
|
153 |
selectors:#(foo1 foo2 foo3) |
|
154 |
receiver:nil. |
|
155 |
menu at:#bar |
|
156 |
putLabels:#('bar1' 'bar2' 'bar3') |
|
157 |
selectors:#(bar1 bar2 bar3) |
|
158 |
receiver:nil. |
|
159 |
top open |
|
128 | 160 |
|
161 |
||
110 | 162 |
|
128 | 163 |
empty entries are possible as selectable items (with non-nil seletor) ... |
593 | 164 |
[exEnd] |
165 |
|top menu| |
|
128 | 166 |
|
593 | 167 |
top := StandardSystemView new. |
168 |
top extent:300@300. |
|
128 | 169 |
|
593 | 170 |
menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
171 |
menu labels:#('foo' 'bar' 'baz'). |
|
172 |
menu selectors:#(foo bar baz). |
|
173 |
menu at:#foo |
|
174 |
putLabels:#('foo1' 'foo2' 'foo3') |
|
175 |
selectors:#(foo1 foo2 foo3) |
|
176 |
receiver:nil. |
|
177 |
menu at:#baz |
|
178 |
putLabels:#('baz1' 'baz2' 'baz3') |
|
179 |
selectors:#(baz1 baz2 baz3) |
|
180 |
receiver:nil. |
|
181 |
top open |
|
110 | 182 |
|
183 |
||
77 | 184 |
|
128 | 185 |
... or as separators (with nil selector) |
593 | 186 |
[exBegin] |
187 |
|top menu| |
|
128 | 188 |
|
593 | 189 |
top := StandardSystemView new. |
190 |
top extent:500@200. |
|
110 | 191 |
|
593 | 192 |
menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
193 |
menu labels:#('foo' ' ' 'bar' ' baz' ' ' 'moreFoo' 'moreBar' 'moreBaz'). |
|
194 |
menu selectors:#(foo nil bar baz nil moreFoo moreBar moreBaz). |
|
195 |
menu at:#foo |
|
196 |
putLabels:#('foo1' 'foo2' 'foo3') |
|
197 |
selectors:#(foo1 foo2 foo3) |
|
198 |
receiver:nil. |
|
199 |
menu at:#bar |
|
200 |
putLabels:#('bar1' 'bar2' 'bar3') |
|
201 |
selectors:#(bar1 bar2 bar3) |
|
202 |
receiver:nil. |
|
203 |
menu at:#baz |
|
204 |
putLabels:#('baz1' 'baz2' 'baz3') |
|
205 |
selectors:#(baz1 baz2 baz3) |
|
206 |
receiver:nil. |
|
207 |
top open |
|
110 | 208 |
|
209 |
||
210 |
||
128 | 211 |
|
212 |
use the menus default height |
|
593 | 213 |
[exEnd] |
214 |
|top menu| |
|
128 | 215 |
|
593 | 216 |
top := StandardSystemView new. |
217 |
top extent:300@300. |
|
77 | 218 |
|
593 | 219 |
menu := PullDownMenu in:top. |
220 |
menu origin:0.0@0.0 corner:1.0@(menu height). |
|
221 |
menu labels:#('foo' 'bar'). |
|
222 |
menu selectors:#(foo bar). |
|
223 |
menu at:#foo |
|
224 |
putLabels:#('foo1' 'foo2' 'foo3') |
|
225 |
selectors:#(foo1 foo2 foo3) |
|
226 |
receiver:nil. |
|
227 |
top open |
|
110 | 228 |
|
77 | 229 |
|
110 | 230 |
|
231 |
||
605
11b03282d684
copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
232 |
although you can change the font, colors etc. (as shown below) |
128 | 233 |
you should NOT do it - since if you do so, the styleSheet settings |
605
11b03282d684
copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
234 |
are ineffective (which users probably won't like) |
128 | 235 |
BTW: The styleSheet entries for below are pullDownMenuForegroundColor, |
593 | 236 |
pullDownMenuBackgroundColor and pullDownMenuFont |
237 |
[exBegin] |
|
238 |
|top menu| |
|
77 | 239 |
|
593 | 240 |
top := StandardSystemView new. |
241 |
menu := PullDownMenu in:top. |
|
242 |
menu font:(Font family:'courier' size:20). |
|
243 |
menu foregroundColor:Color red. |
|
244 |
menu backgroundColor:Color yellow. |
|
245 |
menu viewBackground:Color yellow. |
|
246 |
menu showSeparatingLines:true. |
|
110 | 247 |
|
593 | 248 |
menu origin:0.0@0.0 corner:1.0@(menu height). |
249 |
menu labels:#('foo' 'bar'). |
|
250 |
menu selectors:#(foo bar). |
|
251 |
menu at:#foo |
|
252 |
putLabels:#('foo1' 'foo2' 'foo3') |
|
253 |
selectors:#(foo1 foo2 foo3) |
|
254 |
receiver:nil. |
|
255 |
(menu menuAt:#foo) font:(Font family:'courier' size:36). |
|
256 |
top open |
|
110 | 257 |
|
258 |
||
77 | 259 |
|
128 | 260 |
you can use icons, too ... |
593 | 261 |
[exEnd] |
262 |
|labels top menu| |
|
128 | 263 |
|
593 | 264 |
top := StandardSystemView new. |
265 |
top extent:300@300. |
|
110 | 266 |
|
593 | 267 |
menu := PullDownMenu in:top. |
268 |
menu origin:0.0@0.0 corner:1.0@(menu height). |
|
269 |
labels := Array with:((Image fromFile:'SmalltalkX.xbm') magnifiedTo:16@16) |
|
270 |
with:'foo' |
|
271 |
with:'bar'. |
|
272 |
menu labels:labels. |
|
273 |
menu selectors:#(about foo bar). |
|
274 |
menu at:#about |
|
275 |
putLabels:#('about PullDownMenus') |
|
276 |
selectors:#(aboutMenus) |
|
277 |
receiver:nil. |
|
278 |
menu at:#foo |
|
279 |
putLabels:#('foo1' 'foo2' 'foo3') |
|
280 |
selectors:#(foo1 foo2 foo3) |
|
281 |
receiver:nil. |
|
282 |
top open |
|
110 | 283 |
|
284 |
||
285 |
||
128 | 286 |
a concrete example (combining things described above) |
287 |
(using a Plug, since we have no application class here): |
|
593 | 288 |
[exBegin] |
289 |
|labels top menu textView appModel| |
|
110 | 290 |
|
593 | 291 |
appModel := Plug new. |
292 |
appModel respondTo:#quit with:[top destroy]. |
|
293 |
appModel respondTo:#showAbout with:[self information:'some info here ...']. |
|
294 |
appModel respondTo:#help with:[self information:'some help here ...']. |
|
128 | 295 |
|
593 | 296 |
top := StandardSystemView new. |
297 |
top extent:300@300. |
|
128 | 298 |
|
593 | 299 |
menu := PullDownMenu in:top. |
300 |
menu receiver:appModel. |
|
301 |
menu origin:0.0@0.0 corner:1.0@(menu height). |
|
77 | 302 |
|
593 | 303 |
textView := ScrollableView forView:(EditTextView new). |
304 |
textView origin:0.0@menu height corner:1.0@1.0. |
|
305 |
top addSubView:textView. |
|
128 | 306 |
|
593 | 307 |
labels := Array with:((Image fromFile:'SmalltalkX.xbm') magnifiedTo:16@16) |
308 |
with:'file' |
|
309 |
with:'edit' |
|
310 |
with:'help'. |
|
311 |
menu labels:labels. |
|
312 |
menu selectors:#(about file edit help). |
|
313 |
menu at:#about |
|
314 |
putLabels:#('about PullDownMenus') |
|
315 |
selectors:#(showAbout) |
|
316 |
receiver:appModel. |
|
317 |
menu at:#file |
|
318 |
putLabels:#('quit') |
|
319 |
selectors:#(quit) |
|
320 |
receiver:appModel. |
|
321 |
menu at:#edit |
|
322 |
putLabels:#('copy' 'cut' 'paste') |
|
323 |
selectors:#(copySelection cut paste) |
|
324 |
receiver:textView. |
|
325 |
top open |
|
326 |
[exEnd] |
|
3 | 327 |
" |
202 | 328 |
! ! |
329 |
||
330 |
!PullDownMenu class methodsFor:'instance creation'! |
|
331 |
||
332 |
labels:titleArray |
|
333 |
"create and return a new PullDownMenu" |
|
334 |
||
335 |
^ self new labels:titleArray |
|
3 | 336 |
! ! |
0 | 337 |
|
59 | 338 |
!PullDownMenu class methodsFor:'defaults'! |
339 |
||
340 |
updateStyleCache |
|
110 | 341 |
"extract values from the styleSheet and cache them in class variables" |
342 |
||
456 | 343 |
<resource: #style (#pullDownMenuViewBackground #menuViewBackground |
344 |
#pullDownMenuForegroundColor #menuForegroundColor |
|
345 |
#pullDownMenuBackgroundColor #menuBackgroundColor |
|
346 |
#pullDownMenuHilightForegroundColor #menuHilightForegroundColor |
|
347 |
#pullDownMenuHilightBackgroundColor #menuHilightBackgroundColor |
|
348 |
#pullDownMenuHilightLevel #menuHilightLevel |
|
349 |
#pullDownMenuEdgeStyle #pullDownMenuKeepMenu |
|
350 |
#pullDownMenuToggleKeep #pullDownMenuLevel |
|
351 |
#pullDownMenuFont #menuFont |
|
352 |
#pullDownMenuSeparatingLines)> |
|
353 |
||
133 | 354 |
|styleSheet| |
355 |
||
356 |
styleSheet := StyleSheet. |
|
357 |
||
358 |
DefaultViewBackground := styleSheet colorAt:'pullDownMenuViewBackground'. |
|
60 | 359 |
DefaultViewBackground isNil ifTrue:[ |
456 | 360 |
DefaultViewBackground := styleSheet colorAt:'menuViewBackground'. |
59 | 361 |
]. |
133 | 362 |
DefaultForegroundColor := styleSheet colorAt:'pullDownMenuForegroundColor'. |
60 | 363 |
DefaultForegroundColor isNil ifTrue:[ |
456 | 364 |
DefaultForegroundColor := styleSheet colorAt:'menuForegroundColor'. |
60 | 365 |
]. |
133 | 366 |
DefaultBackgroundColor := styleSheet colorAt:'pullDownMenuBackgroundColor'. |
60 | 367 |
DefaultBackgroundColor isNil ifTrue:[ |
456 | 368 |
DefaultViewBackground notNil ifTrue:[ |
369 |
DefaultBackgroundColor := DefaultViewBackground |
|
370 |
] ifFalse:[ |
|
371 |
DefaultBackgroundColor := styleSheet colorAt:'menuBackgroundColor'. |
|
372 |
] |
|
59 | 373 |
]. |
133 | 374 |
DefaultHilightForegroundColor := styleSheet colorAt:'pullDownMenuHilightForegroundColor'. |
60 | 375 |
DefaultHilightForegroundColor isNil ifTrue:[ |
456 | 376 |
DefaultHilightForegroundColor := styleSheet colorAt:'menuHilightForegroundColor'. |
59 | 377 |
]. |
133 | 378 |
DefaultHilightBackgroundColor := styleSheet colorAt:'pullDownMenuHilightBackgroundColor'. |
60 | 379 |
DefaultHilightBackgroundColor isNil ifTrue:[ |
456 | 380 |
DefaultHilightBackgroundColor := styleSheet colorAt:'menuHilightBackgroundColor'. |
59 | 381 |
]. |
133 | 382 |
DefaultHilightLevel := styleSheet at:'pullDownMenuHilightLevel'. |
60 | 383 |
DefaultHilightLevel isNil ifTrue:[ |
456 | 384 |
DefaultHilightLevel := styleSheet at:'menuHilightLevel' default:0. |
59 | 385 |
]. |
133 | 386 |
DefaultEdgeStyle := styleSheet at:'pullDownMenuEdgeStyle'. |
387 |
DefaultKeepMenu := styleSheet at:'pullDownMenuKeepMenu' default:false. |
|
388 |
DefaultToggleKeep := styleSheet at:'pullDownMenuToggleKeep' default:false. |
|
389 |
DefaultLevel := styleSheet at:'pullDownMenuLevel' default:1. |
|
390 |
DefaultFont := styleSheet fontAt:'pullDownMenuFont'. |
|
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
391 |
DefaultFont isNil ifTrue:[DefaultFont := styleSheet fontAt:'menuFont']. |
133 | 392 |
DefaultSeparatingLines := styleSheet at:'pullDownMenuSeparatingLines' default:false. |
110 | 393 |
|
394 |
" |
|
395 |
PullDownMenu updateStyleCache |
|
396 |
" |
|
456 | 397 |
|
398 |
"Modified: 1.3.1996 / 13:45:19 / cg" |
|
59 | 399 |
! ! |
400 |
||
202 | 401 |
!PullDownMenu methodsFor:'accessing'! |
402 |
||
750 | 403 |
add:label selector:selector |
404 |
"add a new title-item at the end. |
|
405 |
The corresponding label can later be set with #at:putMenu: |
|
406 |
or #at:putLabels:selectors:..." |
|
542 | 407 |
|
750 | 408 |
self add:label selector:selector after:nil |
542 | 409 |
|
750 | 410 |
"Modified: 5.6.1996 / 16:45:46 / cg" |
283 | 411 |
! |
412 |
||
413 |
add:label selector:selector after:indexOrString |
|
750 | 414 |
"add a new title-item after an existing item, indexOrString, |
415 |
or at the end if the after-arg is nil. |
|
416 |
The corresponding label can later be set with #at:putMenu: |
|
417 |
or #at:putLabels:selectors:..." |
|
283 | 418 |
|
750 | 419 |
|idx| |
283 | 420 |
|
750 | 421 |
indexOrString isNil ifTrue:[ |
422 |
idx := titles size |
|
423 |
] ifFalse:[ |
|
424 |
idx := self indexOf:indexOrString. |
|
425 |
]. |
|
283 | 426 |
|
750 | 427 |
titles isNil ifTrue:[ |
428 |
menus := Array with:nil. |
|
429 |
titles := Array with:label. |
|
430 |
selectors := Array with:selector. |
|
431 |
] ifFalse:[ |
|
432 |
menus := (menus copyTo:idx) , #(nil) , (menus copyFrom:idx+1). |
|
433 |
titles := ((titles copyTo:idx) copyWith:label) , (titles copyFrom:idx+1). |
|
434 |
selectors := ((selectors copyTo:idx) copyWith:selector) , (selectors copyFrom:idx+1). |
|
435 |
]. |
|
283 | 436 |
|
750 | 437 |
" |
438 |
|top m| |
|
283 | 439 |
|
750 | 440 |
top := StandardSystemView new. |
441 |
m := PullDownMenu in:top. |
|
442 |
m labels:#('file' 'edit'). |
|
443 |
m selectors:#(file #edit). |
|
283 | 444 |
|
750 | 445 |
m add:'help' selector:#help after:#file. |
446 |
m at:#help putMenu:(MenuView labels:#('foo' 'bar') |
|
447 |
selectors:#(foo bar) |
|
448 |
receiver:nil). |
|
283 | 449 |
|
750 | 450 |
top open |
451 |
" |
|
532
689d1c622a14
oops - adding to an empty menu forgor selector
Claus Gittinger <cg@exept.de>
parents:
518
diff
changeset
|
452 |
|
750 | 453 |
"Modified: 5.6.1996 / 16:45:55 / cg" |
283 | 454 |
! |
455 |
||
202 | 456 |
at:aString putLabels:labels selector:selector args:args receiver:anObject |
750 | 457 |
"create and set the menu under the title, aString |
458 |
OBSOLETE protocol: labels:selectors:args:receiver: knows how to handle a |
|
459 |
single symbol-arg for selectors ..." |
|
202 | 460 |
|
750 | 461 |
^ self at:aString putLabels:labels selectors:selector args:args receiver:anObject |
462 |
||
463 |
"Modified: 5.6.1996 / 16:47:32 / cg" |
|
202 | 464 |
! |
465 |
||
518
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
466 |
at:aString putLabels:labels selectors:selectors |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
467 |
"create and set the menu under the title, aString" |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
468 |
|
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
469 |
^ self at:aString putLabels:labels selectors:selectors receiver:nil |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
470 |
|
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
471 |
"Created: 24.3.1996 / 17:06:45 / cg" |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
472 |
! |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
473 |
|
750 | 474 |
at:aString putLabels:labels selectors:selectors accelerators:shorties args:args receiver:anObject |
475 |
"create and set the menu under the title, aString" |
|
476 |
||
477 |
|menuView| |
|
478 |
||
479 |
menuView := MenuView labels:labels |
|
480 |
selectors:selectors |
|
481 |
accelerators:shorties |
|
482 |
args:args |
|
483 |
receiver:anObject |
|
484 |
for:self. |
|
485 |
self at:aString putMenu:menuView |
|
486 |
||
487 |
"Created: 5.6.1996 / 16:51:48 / cg" |
|
488 |
! |
|
489 |
||
490 |
at:aString putLabels:labels selectors:selectors accelerators:shorties receiver:anObject |
|
491 |
"create and set the menu under the title, aString" |
|
492 |
||
493 |
self at:aString putLabels:labels selectors:selectors accelerators:shorties args:nil receiver:anObject |
|
494 |
||
495 |
"Modified: 5.6.1996 / 16:48:26 / cg" |
|
496 |
"Created: 5.6.1996 / 16:53:39 / cg" |
|
497 |
! |
|
498 |
||
202 | 499 |
at:aString putLabels:labels selectors:selectors args:args receiver:anObject |
500 |
"create and set the menu under the title, aString" |
|
501 |
||
502 |
|menuView| |
|
503 |
||
504 |
menuView := MenuView labels:labels |
|
505 |
selectors:selectors |
|
506 |
args:args |
|
507 |
receiver:anObject |
|
508 |
for:self. |
|
509 |
self at:aString putMenu:menuView |
|
510 |
! |
|
511 |
||
512 |
at:aString putLabels:labels selectors:selectors receiver:anObject |
|
513 |
"create and set the menu under the title, aString" |
|
514 |
||
750 | 515 |
self at:aString putLabels:labels selectors:selectors args:nil receiver:anObject |
202 | 516 |
|
750 | 517 |
"Modified: 5.6.1996 / 16:48:26 / cg" |
202 | 518 |
! |
519 |
||
520 |
at:aString putMenu:aMenu |
|
521 |
"set the menu under the title, aString" |
|
522 |
||
523 |
|index| |
|
524 |
||
525 |
index := self indexOf:aString. |
|
526 |
(index == 0) ifTrue:[ |
|
620
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
527 |
self error:'no such menu entry'. |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
528 |
^ nil |
202 | 529 |
]. |
530 |
||
620
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
531 |
aMenu container:(self superView). |
291 | 532 |
aMenu beInvisible. |
202 | 533 |
menus at:index put:aMenu. |
534 |
aMenu masterView:self. |
|
620
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
535 |
|
750 | 536 |
"Modified: 5.6.1996 / 16:48:50 / cg" |
202 | 537 |
! |
538 |
||
539 |
labels |
|
540 |
"return the menu-titles (group-headers)" |
|
541 |
||
542 |
^ titles |
|
543 |
! |
|
0 | 544 |
|
545 |
labels:titleArray |
|
202 | 546 |
"define the menu-titles (group-headers)" |
547 |
||
548 |
|numberOfLabels| |
|
549 |
||
550 |
numberOfLabels := titleArray size. |
|
551 |
menus := Array new:numberOfLabels. |
|
552 |
titles := Array new:numberOfLabels. |
|
553 |
||
554 |
titleArray keysAndValuesDo:[:index :entry | |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
555 |
|e| |
202 | 556 |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
557 |
entry isImage ifTrue:[ |
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
558 |
e := entry on:device |
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
559 |
] ifFalse:[ |
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
560 |
e := entry printString |
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
561 |
]. |
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
562 |
titles at:index put:e |
202 | 563 |
]. |
564 |
shown ifTrue:[ |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
565 |
self invalidate "/ clear; redraw |
202 | 566 |
] |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
567 |
|
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
568 |
"Modified: 29.5.1996 / 16:21:00 / cg" |
202 | 569 |
! |
570 |
||
571 |
labels:titleArray selectors:selectorArray |
|
572 |
"define the menu-titles (group-headers) and selectors. |
|
573 |
Selectors are mostly used as access keys to get to submenus later." |
|
574 |
||
575 |
self labels:titleArray. |
|
576 |
self selectors:selectorArray |
|
577 |
||
578 |
"Created: 20.10.1995 / 20:15:54 / cg" |
|
579 |
! |
|
580 |
||
581 |
menuAt:stringOrNumber |
|
518
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
582 |
"return the menu with the title; nil if not found" |
202 | 583 |
|
518
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
584 |
^ self subMenuAt:stringOrNumber |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
585 |
|
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
586 |
"Modified: 24.3.1996 / 17:10:11 / cg" |
202 | 587 |
! |
588 |
||
589 |
numberOfTitles:n |
|
590 |
"setup blank title-space to be filled in later" |
|
591 |
||
592 |
menus := Array new:n. |
|
593 |
titles := Array new:n |
|
594 |
! |
|
595 |
||
596 |
receiver:anObject |
|
597 |
"set the menu-receiver. Thats the one who gets the |
|
598 |
messages (both from myself and from my submenus). |
|
599 |
This only sets the receiver for menus which are already |
|
600 |
created - menus added later should get their receiver in |
|
601 |
the creation send." |
|
602 |
||
603 |
receiver := anObject. |
|
604 |
menus notNil ifTrue:[ |
|
605 |
menus do:[:aMenu | |
|
606 |
aMenu notNil ifTrue:[ |
|
607 |
aMenu receiver:anObject |
|
608 |
] |
|
609 |
] |
|
610 |
] |
|
611 |
! |
|
612 |
||
283 | 613 |
selectors |
614 |
"return the menu-selectors" |
|
615 |
||
616 |
^ selectors |
|
617 |
! |
|
618 |
||
202 | 619 |
selectors:selectorArray |
620 |
"define the menu-selectors. These are used as accesskey only |
|
621 |
in menuAt: accesses. This makes PullDownMenu accesss |
|
622 |
somewhat more compatible to PopUpMenus." |
|
623 |
||
605
11b03282d684
copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
624 |
selectors := selectorArray copy. |
283 | 625 |
|
605
11b03282d684
copy selectors, args & shortKeys
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
626 |
"Modified: 30.4.1996 / 15:57:04 / cg" |
518
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
627 |
! |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
628 |
|
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
629 |
subMenuAt:stringOrNumber |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
630 |
"return the menu with the title; nil if not found." |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
631 |
|
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
632 |
|index| |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
633 |
|
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
634 |
index := self indexOf:stringOrNumber. |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
635 |
(index == 0) ifTrue:[^ nil]. |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
636 |
^ menus at:index |
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
637 |
|
731c905a6d89
unified #menuAt/#subMenuAt method names
Claus Gittinger <cg@exept.de>
parents:
516
diff
changeset
|
638 |
"Modified: 24.3.1996 / 17:09:56 / cg" |
202 | 639 |
! ! |
640 |
||
750 | 641 |
!PullDownMenu methodsFor:'accessing-behavior'! |
642 |
||
643 |
actionAt:stringOrNumber |
|
644 |
"return the actionBlock associated with stringOrNumber; |
|
645 |
nil if there is none (but there may be still a selector there)." |
|
646 |
||
647 |
|index| |
|
648 |
||
649 |
actions isNil ifTrue:[^ nil]. |
|
650 |
index := self indexOf:stringOrNumber. |
|
651 |
(index == 0) ifTrue:[^ nil]. |
|
652 |
^ actions at:index ifAbsent:nil |
|
653 |
||
654 |
"Modified: 24.3.1996 / 17:09:56 / cg" |
|
655 |
"Created: 17.4.1996 / 20:50:45 / cg" |
|
656 |
! |
|
657 |
||
658 |
actionAt:stringOrNumber put:aBlock |
|
659 |
"return the actionBlock associated with stringOrNumber; |
|
660 |
nil if there is none (but there may be still a selector there)." |
|
661 |
||
662 |
|index newActions| |
|
663 |
||
664 |
index := self indexOf:stringOrNumber. |
|
665 |
(index == 0) ifTrue:[^ nil]. |
|
666 |
actions size < index ifTrue:[ |
|
667 |
newActions := Array new:index. |
|
668 |
newActions replaceFrom:1 to:actions size with:actions. |
|
669 |
actions := newActions |
|
670 |
]. |
|
671 |
actions at:index put:aBlock |
|
672 |
||
673 |
"Modified: 24.3.1996 / 17:09:56 / cg" |
|
674 |
"Created: 17.4.1996 / 20:52:13 / cg" |
|
675 |
! ! |
|
676 |
||
202 | 677 |
!PullDownMenu methodsFor:'accessing-look'! |
678 |
||
679 |
backgroundColor:aColor |
|
680 |
"set the background drawing color. |
|
681 |
You should not use this method; instead leave the value as |
|
682 |
defined in the styleSheet." |
|
683 |
||
684 |
bgColor := aColor on:device |
|
685 |
! |
|
686 |
||
687 |
font:aFont |
|
688 |
"set the menus font. |
|
689 |
adjusts menu-origins when font changes. |
|
690 |
You should not use this method; instead leave the value as |
|
665 | 691 |
defined in the styleSheet. |
692 |
CAVEAT: with the addition of Text objects, |
|
693 |
this method is going to be obsoleted by a textStyle |
|
694 |
method, which allows specific control over |
|
695 |
normalFont/boldFont/italicFont parameters." |
|
202 | 696 |
|
697 |
aFont ~~ font ifTrue:[ |
|
665 | 698 |
super font:(aFont on:device). |
699 |
self height:(font height + (font descent * 2)). |
|
700 |
shown ifTrue:[ |
|
701 |
self setMenuOrigins |
|
702 |
] |
|
202 | 703 |
] |
665 | 704 |
|
705 |
"Modified: 22.5.1996 / 12:37:04 / cg" |
|
202 | 706 |
! |
707 |
||
708 |
foregroundColor:aColor |
|
709 |
"set the foreground drawing color. |
|
710 |
You should not use this method; instead leave the value as |
|
711 |
defined in the styleSheet." |
|
712 |
||
713 |
fgColor := aColor on:device |
|
714 |
! |
|
715 |
||
716 |
showSeparatingLines:aBoolean |
|
717 |
"turn on/off drawing of separating lines. |
|
718 |
You should not use this method; instead leave the value as |
|
719 |
defined in the styleSheet." |
|
720 |
||
721 |
showSeparatingLines := aBoolean. |
|
722 |
shown ifTrue:[ |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
723 |
self setMenuOrigins. |
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
724 |
self invalidate |
202 | 725 |
] |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
726 |
|
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
727 |
"Modified: 29.5.1996 / 16:21:06 / cg" |
202 | 728 |
! ! |
729 |
||
730 |
!PullDownMenu methodsFor:'drawing '! |
|
731 |
||
732 |
drawActiveTitleSelected:selected |
|
733 |
|x| |
|
734 |
activeMenuNumber notNil ifTrue:[ |
|
735 |
x := self titleLenUpTo:activeMenuNumber. |
|
736 |
self drawTitle:(titles at:activeMenuNumber) x:x selected:selected |
|
737 |
] |
|
738 |
! |
|
739 |
||
740 |
drawTitle:stringOrImage x:x0 selected:selected |
|
741 |
|y w x wSpace fg bg map| |
|
742 |
||
743 |
selected ifTrue:[ |
|
744 |
fg := activeFgColor. |
|
745 |
bg := activeBgColor |
|
746 |
] ifFalse:[ |
|
747 |
fg := fgColor. |
|
748 |
bg := bgColor |
|
749 |
]. |
|
750 |
||
751 |
wSpace := font widthOf:' '. |
|
752 |
x := x0. |
|
753 |
stringOrImage isString ifTrue:[ |
|
754 |
y := ((height - (font height)) // 2) + (font ascent) "+ topMargin". |
|
755 |
w := font widthOf:stringOrImage. |
|
756 |
] ifFalse:[ |
|
757 |
y := ((height - stringOrImage height) // 2) max:0. |
|
758 |
w := stringOrImage width |
|
759 |
]. |
|
760 |
w := w + (wSpace * 2). |
|
761 |
||
762 |
self paint:bg. |
|
763 |
self fillRectangleX:x y:0 width:w height:height. |
|
764 |
||
765 |
self is3D ifTrue:[ |
|
766 |
self drawEdgesForX:x y:0 |
|
767 |
width:w |
|
768 |
height:height |
|
769 |
level:(selected ifTrue:[onLevel] ifFalse:[offLevel]) |
|
770 |
]. |
|
250
77012e65ac84
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
771 |
self paint:fg on:bg. |
202 | 772 |
x := x + wSpace. |
773 |
stringOrImage isString ifTrue:[ |
|
250
77012e65ac84
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
774 |
self displayOpaqueString:stringOrImage x:x y:y |
202 | 775 |
] ifFalse:[ |
776 |
stringOrImage isImageOrForm ifTrue:[ |
|
777 |
stringOrImage depth == 1 ifTrue:[ |
|
778 |
(map := stringOrImage colorMap) notNil ifTrue:[ |
|
779 |
self paint:(map at:2) on:(map at:1). |
|
780 |
self displayOpaqueForm:stringOrImage x:x y:y. |
|
781 |
^ self |
|
782 |
] |
|
783 |
]. |
|
784 |
self displayForm:stringOrImage x:x y:y |
|
785 |
] ifFalse:[ |
|
786 |
stringOrImage displayOn:self x:x y:y |
|
787 |
] |
|
788 |
] |
|
789 |
||
790 |
"Modified: 20.10.1995 / 22:03:27 / cg" |
|
791 |
! |
|
792 |
||
793 |
highlightActiveTitle |
|
794 |
self drawActiveTitleSelected:true |
|
795 |
! |
|
796 |
||
797 |
redraw |
|
798 |
|x "{ Class: SmallInteger }" |
|
799 |
y "{ Class: SmallInteger }" |
|
800 |
index "{ Class: SmallInteger }" |
|
801 |
wSpace clr| |
|
802 |
||
803 |
shown ifFalse: [ ^ self ]. |
|
804 |
titles isNil ifTrue:[^ self]. |
|
805 |
||
806 |
wSpace := (font widthOf:' '). |
|
807 |
x := 0. |
|
808 |
y := height "- 1". |
|
809 |
index := 1. |
|
810 |
titles do:[:title | |
|
811 |
self drawTitle:title x:x selected:(index == activeMenuNumber). |
|
812 |
||
813 |
title isString ifTrue:[ |
|
814 |
x := x + (font widthOf:title). |
|
815 |
] ifFalse:[ |
|
816 |
x := x + title width |
|
817 |
]. |
|
818 |
x := x + wSpace + wSpace. |
|
819 |
showSeparatingLines ifTrue:[ |
|
820 |
self is3D ifTrue:[ |
|
821 |
self paint:shadowColor. |
|
822 |
self displayLineFromX:x y:0 toX:x y:y. |
|
823 |
x := x + 1. |
|
824 |
clr := lightColor. |
|
825 |
] ifFalse:[ |
|
826 |
clr := fgColor. |
|
827 |
]. |
|
828 |
self paint:clr. |
|
829 |
self displayLineFromX:x y:0 toX:x y:y. |
|
830 |
x := x + 1 |
|
831 |
]. |
|
832 |
index := index + 1 |
|
833 |
] |
|
834 |
! |
|
835 |
||
836 |
unHighlightActiveTitle |
|
837 |
self drawActiveTitleSelected:false |
|
838 |
! ! |
|
839 |
||
840 |
!PullDownMenu methodsFor:'event handling'! |
|
841 |
||
842 |
buttonMotion:state x:x y:y |
|
843 |
|titleIndex activeMenu activeLeft activeTop| |
|
844 |
||
845 |
state == 0 ifTrue:[^ self]. |
|
846 |
||
847 |
activeMenuNumber notNil ifTrue:[ |
|
684 | 848 |
activeMenu := menus at:activeMenuNumber. |
202 | 849 |
]. |
0 | 850 |
|
202 | 851 |
(y < height) ifTrue:[ |
684 | 852 |
"moving around in title line" |
853 |
activeMenu notNil ifTrue:[ |
|
854 |
activeMenu setSelection:nil |
|
855 |
]. |
|
856 |
titleIndex := self titleIndexForX:x. |
|
857 |
titleIndex notNil ifTrue:[ |
|
858 |
(titleIndex ~~ activeMenuNumber) ifTrue:[ |
|
859 |
self pullMenu:titleIndex |
|
860 |
] |
|
861 |
] ifFalse:[ |
|
862 |
self hideActiveMenu |
|
863 |
] |
|
202 | 864 |
] ifFalse:[ |
684 | 865 |
"moving around below" |
866 |
activeMenu isNil ifTrue:[^self]. |
|
867 |
activeLeft := activeMenu left. |
|
868 |
(x between:activeLeft and:(activeMenu right)) ifTrue:[ |
|
869 |
activeTop := activeMenu top. |
|
870 |
(y between:activeTop and:(activeMenu bottom)) ifTrue:[ |
|
871 |
"moving around in menu" |
|
872 |
activeMenu buttonMotion:state |
|
873 |
x:(x - activeLeft) |
|
874 |
y:(y - activeTop). |
|
875 |
^ self |
|
876 |
] |
|
877 |
]. |
|
878 |
"moved outside menu" |
|
879 |
activeMenu setSelection:nil |
|
202 | 880 |
] |
684 | 881 |
|
882 |
"Modified: 25.5.1996 / 12:28:32 / cg" |
|
202 | 883 |
! |
884 |
||
885 |
buttonPress:button x:x y:y |
|
886 |
|titleIndex activeMenu activeLeft activeTop m| |
|
887 |
||
888 |
device ungrabPointer. |
|
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
889 |
device ungrabKeyboard. |
202 | 890 |
|
891 |
(y between:0 and:height) ifTrue:[ |
|
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
892 |
titleIndex := self titleIndexForX:x. |
202 | 893 |
]. |
894 |
||
895 |
" |
|
896 |
now, titleIndex is non-nil if pressed within myself |
|
897 |
" |
|
898 |
(titleIndex notNil and:[titleIndex ~~ activeMenuNumber]) ifTrue:[ |
|
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
899 |
m := self pullMenu:titleIndex. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
900 |
(keepMenu and:[m notNil]) ifTrue:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
901 |
device grabPointerInView:self. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
902 |
device grabKeyboardInView:self. |
484 | 903 |
"/ self cursor:Cursor upRightArrow |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
904 |
] |
202 | 905 |
] ifFalse:[ |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
906 |
(keepMenu and:[toggleKeep not]) ifTrue:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
907 |
titleIndex == activeMenuNumber ifTrue:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
908 |
"same pressed again ... stay" |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
909 |
titleIndex notNil ifTrue:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
910 |
device grabPointerInView:self. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
911 |
device grabKeyboardInView:self. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
912 |
]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
913 |
^ self |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
914 |
]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
915 |
"moving around below" |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
916 |
activeMenuNumber isNil ifTrue:[^self]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
917 |
activeMenu := menus at:activeMenuNumber. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
918 |
activeLeft := activeMenu left. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
919 |
(x between:activeLeft and:(activeMenu right)) ifTrue:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
920 |
activeTop := activeMenu top. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
921 |
(y between:activeTop and:(activeMenu bottom)) ifTrue:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
922 |
"moving around in menu" |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
923 |
activeMenu buttonPress:button |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
924 |
x:(x - activeLeft) |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
925 |
y:(y - activeTop). |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
926 |
^ self |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
927 |
] |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
928 |
]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
929 |
]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
930 |
self hideActiveMenu |
202 | 931 |
] |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
932 |
|
484 | 933 |
"Modified: 6.3.1996 / 17:14:16 / cg" |
202 | 934 |
! |
935 |
||
936 |
buttonRelease:button x:x y:y |
|
937 |
|activeMenu activeLeft activeTop hideMenu sel| |
|
938 |
||
939 |
activeMenuNumber isNil ifTrue:[^self]. |
|
940 |
activeMenu := menus at:activeMenuNumber. |
|
941 |
||
942 |
hideMenu := false. |
|
943 |
(y >= height) ifTrue:[ |
|
542 | 944 |
"release below title-line" |
945 |
activeLeft := activeMenu left. |
|
946 |
" |
|
947 |
released in a submenu ? |
|
948 |
" |
|
949 |
(x between:activeLeft and:(activeMenu right)) ifTrue:[ |
|
950 |
activeTop := activeMenu top. |
|
951 |
(y between:activeTop and:(activeMenu bottom)) ifTrue:[ |
|
952 |
"release in menu" |
|
953 |
self hideActiveMenu. |
|
954 |
activeMenu buttonRelease:button |
|
955 |
x:(x - activeLeft) |
|
956 |
y:(y - activeTop). |
|
957 |
^ self |
|
958 |
] |
|
959 |
]. |
|
960 |
hideMenu := true. |
|
202 | 961 |
] ifFalse:[ |
542 | 962 |
y < 0 ifTrue:[ |
963 |
hideMenu := true |
|
964 |
] ifFalse:[ |
|
965 |
activeMenu isNil ifTrue:[ |
|
966 |
self performSelectedAction. |
|
967 |
hideMenu := true. |
|
968 |
] ifFalse:[ |
|
969 |
keepMenu ifFalse:[ |
|
970 |
hideMenu := true |
|
971 |
] |
|
972 |
] |
|
973 |
] |
|
202 | 974 |
]. |
975 |
hideMenu ifTrue:[ |
|
976 |
self hideActiveMenu. |
|
977 |
] |
|
542 | 978 |
|
979 |
"Modified: 17.4.1996 / 20:56:08 / cg" |
|
202 | 980 |
! |
981 |
||
982 |
keyPress:key x:x y:y |
|
491 | 983 |
|
202 | 984 |
<resource: #keyboard (#CursorLeft #CursorRight #MenuSelect)> |
985 |
||
513
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
986 |
|index startIndex m sel| |
202 | 987 |
|
988 |
" |
|
989 |
handle CursorLeft/Right for non-mouse operation |
|
990 |
(for example, if it has the explicit focus) |
|
991 |
These will pull the previous/next menu |
|
992 |
" |
|
993 |
((key == #CursorRight) or:[key == #CursorLeft]) ifTrue:[ |
|
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
994 |
activeMenuNumber isNil ifTrue:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
995 |
index := (key == #CursorRight) ifTrue:[1] ifFalse:[menus size]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
996 |
] ifFalse:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
997 |
(key == #CursorRight) ifTrue:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
998 |
index := activeMenuNumber+1 |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
999 |
] ifFalse:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1000 |
index := activeMenuNumber-1 |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1001 |
]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1002 |
index == 0 ifTrue:[index := menus size] |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1003 |
ifFalse:[ |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1004 |
index > menus size ifTrue:[index := 1] |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1005 |
] |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1006 |
]. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1007 |
self pullMenu:index. |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1008 |
^ self |
202 | 1009 |
]. |
1010 |
||
513
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1011 |
"/ activeMenuNumber isNil ifTrue:[ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1012 |
"/ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1013 |
"/ find an item starting with that alpha-key |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1014 |
"/ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1015 |
key isCharacter ifTrue:[ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1016 |
(key isLetter) ifTrue:[ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1017 |
activeMenuNumber isNil ifTrue:[ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1018 |
startIndex := 1. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1019 |
] ifFalse:[ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1020 |
startIndex := activeMenuNumber + 1 |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1021 |
]. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1022 |
index := titles |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1023 |
findFirst:[:item | |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1024 |
item isString |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1025 |
and:[(item startsWith:key asUppercase) |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1026 |
or:[item startsWith:key asLowercase]]] |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1027 |
startingAt:startIndex. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1028 |
|
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1029 |
(index == 0 and:[startIndex ~~ 1]) ifTrue:[ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1030 |
index := titles |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1031 |
findFirst:[:item | |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1032 |
item isString |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1033 |
and:[(item startsWith:key asUppercase) |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1034 |
or:[item startsWith:key asLowercase]]] |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1035 |
startingAt:1. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1036 |
]. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1037 |
|
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1038 |
index ~~ 0 ifTrue:[ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1039 |
self pullMenu:index. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1040 |
]. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1041 |
^ self |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1042 |
] |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1043 |
]. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1044 |
"/ ]. |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1045 |
|
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1046 |
activeMenuNumber isNil ifTrue:[ |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1047 |
^ super keyPress:key x:x y:y |
97fe3c60042b
quick item select (press alpha key for item)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
1048 |
]. |
202 | 1049 |
|
1050 |
" |
|
1051 |
Return, space or the (virtual) MenuSelect key trigger |
|
1052 |
a menu entry (for non-submenu entries). |
|
1053 |
Otherwise, if we have a submenu open, |
|
1054 |
pass the key on to it ... |
|
1055 |
" |
|
1056 |
m := menus at:activeMenuNumber. |
|
1057 |
m isNil ifTrue:[ |
|
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1058 |
(key == #Return |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1059 |
or:[key == #MenuSelect |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1060 |
or:[key == Character space]]) ifTrue:[ |
542 | 1061 |
self performSelectedAction. |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1062 |
]. |
202 | 1063 |
] ifFalse:[ |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1064 |
m keyPress:key x:0 y:0. |
202 | 1065 |
]. |
491 | 1066 |
|
542 | 1067 |
"Modified: 17.4.1996 / 20:56:20 / cg" |
202 | 1068 |
! |
1069 |
||
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1070 |
showNoFocus:explicit |
202 | 1071 |
"when stepping focus, hide any active menu" |
1072 |
||
1073 |
self hideActiveMenu. |
|
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1074 |
super showNoFocus:explicit |
202 | 1075 |
! ! |
1076 |
||
1077 |
!PullDownMenu methodsFor:'hiding/showing menus'! |
|
1078 |
||
317
f23de8b78f5e
Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1079 |
hide |
f23de8b78f5e
Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1080 |
"sent by an aborted menu" |
f23de8b78f5e
Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1081 |
|
f23de8b78f5e
Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1082 |
self hideActiveMenu. |
f23de8b78f5e
Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1083 |
! |
f23de8b78f5e
Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1084 |
|
202 | 1085 |
hideActiveMenu |
1086 |
"hide currently active menu - release grab if there is any grab (keepMenu)" |
|
1087 |
||
1088 |
^ self hideActiveMenuRelease:true |
|
1089 |
! |
|
1090 |
||
1091 |
hideActiveMenuRelease:aBoolean |
|
1092 |
"hide currently active menu - release grab if aBoolean is true |
|
1093 |
and a grab was set (keepMenu)" |
|
1094 |
||
1095 |
|m| |
|
1096 |
||
1097 |
activeMenuNumber notNil ifTrue:[ |
|
476
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1098 |
(m := menus at:activeMenuNumber) notNil ifTrue:[ |
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1099 |
m beInvisible. |
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1100 |
]. |
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1101 |
self unHighlightActiveTitle. |
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1102 |
activeMenuNumber := nil |
202 | 1103 |
]. |
1104 |
aBoolean ifTrue:[ |
|
476
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1105 |
device ungrabKeyboard. |
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1106 |
device ungrabPointer. |
484 | 1107 |
"/ self cursor:Cursor normal |
202 | 1108 |
]. |
476
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1109 |
|
484 | 1110 |
"Modified: 6.3.1996 / 17:14:21 / cg" |
202 | 1111 |
! |
1112 |
||
1113 |
pullMenu:aNumber |
|
1114 |
"activate a menu, return it or nil" |
|
1115 |
||
760 | 1116 |
<resource: #style (#pullDownMenuAutoselectFirst)> |
1117 |
||
202 | 1118 |
|subMenu r posY| |
1119 |
||
1120 |
activeMenuNumber notNil ifTrue:[self hideActiveMenuRelease:false]. |
|
1121 |
activeMenuNumber := aNumber. |
|
1122 |
subMenu := menus at:aNumber. |
|
1123 |
||
1124 |
raiseTopWhenActivated ifTrue:[ |
|
631
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1125 |
self topView raise. |
202 | 1126 |
]. |
1127 |
||
1128 |
(activeMenuNumber notNil |
|
1129 |
and:[ |
|
631
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1130 |
subMenu notNil |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1131 |
or:[selectors notNil and:[(selectors at:activeMenuNumber) notNil]]]) ifTrue:[ |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1132 |
self highlightActiveTitle. |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1133 |
]. |
202 | 1134 |
|
1135 |
subMenu notNil ifTrue:[ |
|
631
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1136 |
subMenu origin:((left + (self titleLenUpTo:aNumber)) |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1137 |
@ |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1138 |
(posY := height + subMenu borderWidth)). |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1139 |
subMenu hiddenOnRealize:false. |
684 | 1140 |
subMenu setSelection:nil. |
631
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1141 |
subMenu create. |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1142 |
subMenu saveUnder:true. |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1143 |
subMenu superMenu:self. |
202 | 1144 |
|
631
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1145 |
subMenu right > (r := self right) ifTrue:[ |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1146 |
subMenu origin:((r - subMenu width) @ posY). |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1147 |
]. |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1148 |
subMenu raise show. |
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1149 |
|
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1150 |
(styleSheet at:#pullDownMenuAutoselectFirst) == true ifTrue:[ |
684 | 1151 |
subMenu setSelection:1 |
631
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1152 |
] |
202 | 1153 |
]. |
1154 |
^ subMenu |
|
631
3b50fb0a505e
support autoSelect of first item (motif style)
Claus Gittinger <cg@exept.de>
parents:
620
diff
changeset
|
1155 |
|
760 | 1156 |
"Modified: 12.6.1996 / 14:54:09 / cg" |
202 | 1157 |
! |
1158 |
||
1159 |
regainControl |
|
1160 |
keepMenu ifTrue:[ |
|
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1161 |
device grabPointerInView:self. |
476
c101043c91f7
oops - must release the keyboard as well
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
1162 |
device grabKeyboardInView:self. |
484 | 1163 |
"/ self cursor:Cursor upRightArrow |
202 | 1164 |
] |
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1165 |
|
484 | 1166 |
"Modified: 6.3.1996 / 17:14:27 / cg" |
0 | 1167 |
! ! |
1168 |
||
77 | 1169 |
!PullDownMenu methodsFor:'initialize / release'! |
0 | 1170 |
|
620
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1171 |
container:aView |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1172 |
"when my container changes, all of my menus must change as well" |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1173 |
|
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1174 |
super container:aView. |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1175 |
|
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1176 |
menus notNil ifTrue:[ |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1177 |
menus do:[:aMenu | |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1178 |
aMenu notNil ifTrue:[ |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1179 |
aMenu container:aView |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1180 |
] |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1181 |
] |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1182 |
] |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1183 |
|
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1184 |
"Modified: 9.5.1996 / 00:43:13 / cg" |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1185 |
"Created: 9.5.1996 / 00:43:38 / cg" |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1186 |
! |
f513bc136ab7
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
1187 |
|
202 | 1188 |
create |
1189 |
super create. |
|
1190 |
self setMenuOrigins |
|
1191 |
! |
|
1192 |
||
1193 |
destroy |
|
1194 |
"have to destroy the menus manually here, |
|
1195 |
since they are no real subviews of myself" |
|
0 | 1196 |
|
202 | 1197 |
menus notNil ifTrue:[ |
1198 |
menus do:[:m | |
|
1199 |
m notNil ifTrue:[m destroy] |
|
1200 |
]. |
|
1201 |
menus := nil |
|
1202 |
]. |
|
1203 |
activeMenuNumber := nil. |
|
1204 |
super destroy. |
|
1205 |
! |
|
1206 |
||
1207 |
initCursor |
|
1208 |
"set up a hand cursor" |
|
1209 |
||
1210 |
cursor := Cursor hand |
|
0 | 1211 |
! |
1212 |
||
1213 |
initStyle |
|
130 | 1214 |
|style| |
1215 |
||
0 | 1216 |
super initStyle. |
1217 |
||
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1218 |
"/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]. |
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1219 |
|
128 | 1220 |
showSeparatingLines := DefaultSeparatingLines. "/ false. |
59 | 1221 |
DefaultViewBackground notNil ifTrue:[ |
709 | 1222 |
viewBackground := DefaultViewBackground on:device |
59 | 1223 |
]. |
1224 |
||
1225 |
DefaultForegroundColor notNil ifTrue:[ |
|
709 | 1226 |
fgColor := DefaultForegroundColor |
59 | 1227 |
] ifFalse:[ |
709 | 1228 |
fgColor := Black. |
59 | 1229 |
]. |
1230 |
DefaultBackgroundColor notNil ifTrue:[ |
|
709 | 1231 |
bgColor := DefaultBackgroundColor |
59 | 1232 |
] ifFalse:[ |
709 | 1233 |
bgColor := viewBackground. |
59 | 1234 |
]. |
1235 |
onLevel := DefaultHilightLevel. |
|
1236 |
offLevel := DefaultLevel. |
|
21 | 1237 |
|
0 | 1238 |
self is3D ifTrue:[ |
709 | 1239 |
device hasColors ifTrue:[ |
1240 |
activeFgColor := Color name:'yellow' |
|
1241 |
] ifFalse:[ |
|
1242 |
activeFgColor := White |
|
1243 |
]. |
|
1244 |
device hasGrayscales ifTrue:[ |
|
1245 |
activeBgColor := bgColor. |
|
1246 |
] ifFalse:[ |
|
1247 |
activeBgColor := fgColor. |
|
1248 |
]. |
|
1249 |
topMargin := 2. |
|
21 | 1250 |
|
709 | 1251 |
style := styleSheet name. |
1252 |
((style == #iris) or:[style == #motif]) ifTrue:[ |
|
1253 |
self level:2. |
|
1254 |
onLevel := 2. |
|
1255 |
offLevel := 0. |
|
1256 |
activeFgColor := fgColor |
|
1257 |
] |
|
0 | 1258 |
] ifFalse:[ |
709 | 1259 |
activeFgColor := bgColor. |
1260 |
activeBgColor := fgColor. |
|
1261 |
topMargin := 0 |
|
59 | 1262 |
]. |
1263 |
||
63 | 1264 |
edgeStyle := DefaultEdgeStyle. |
1265 |
keepMenu := DefaultKeepMenu. |
|
110 | 1266 |
toggleKeep := DefaultToggleKeep. |
63 | 1267 |
|
59 | 1268 |
DefaultHilightForegroundColor notNil ifTrue:[ |
709 | 1269 |
activeFgColor := DefaultHilightForegroundColor |
59 | 1270 |
]. |
1271 |
DefaultHilightBackgroundColor notNil ifTrue:[ |
|
709 | 1272 |
activeBgColor := DefaultHilightBackgroundColor |
0 | 1273 |
]. |
59 | 1274 |
DefaultShadowColor notNil ifTrue:[ |
709 | 1275 |
shadowColor := DefaultShadowColor on:device |
59 | 1276 |
]. |
1277 |
DefaultLightColor notNil ifTrue:[ |
|
709 | 1278 |
lightColor := DefaultLightColor on:device |
59 | 1279 |
]. |
1280 |
||
1281 |
bgColor := bgColor on:device. |
|
1282 |
fgColor := fgColor on:device. |
|
1283 |
activeBgColor := activeBgColor on:device. |
|
1284 |
activeFgColor := activeFgColor on:device. |
|
133 | 1285 |
|
1286 |
raiseTopWhenActivated := styleSheet at:'pullDownMenuRaiseTop' default:true. |
|
709 | 1287 |
|
1288 |
"Modified: 28.5.1996 / 21:13:10 / cg" |
|
133 | 1289 |
! |
1290 |
||
202 | 1291 |
initialize |
1292 |
super initialize. |
|
133 | 1293 |
|
202 | 1294 |
font := font on:device. |
1295 |
self origin:(0.0 @ 0.0) |
|
1296 |
extent:(1.0 @ self preferredExtent y) |
|
1297 |
"/ extent:(1.0 @ (font height + (font descent * 2) + topMargin)). |
|
0 | 1298 |
! |
1299 |
||
1300 |
recreate |
|
128 | 1301 |
"if the image was saved with an active menu, hide it" |
1302 |
||
1303 |
|m| |
|
115 | 1304 |
|
1305 |
activeMenuNumber notNil ifTrue:[ |
|
613 | 1306 |
(m := menus at:activeMenuNumber) notNil ifTrue:[ |
1307 |
m unmap. |
|
1308 |
]. |
|
1309 |
activeMenuNumber := nil. |
|
115 | 1310 |
]. |
1311 |
super recreate. |
|
0 | 1312 |
self setMenuOrigins |
613 | 1313 |
|
1314 |
"Modified: 3.5.1996 / 23:48:55 / stefan" |
|
0 | 1315 |
! ! |
1316 |
||
1317 |
!PullDownMenu methodsFor:'private'! |
|
1318 |
||
1319 |
indexOf:stringOrNumber |
|
91 | 1320 |
"return the index of the menu with title; return 0 if not found. |
1321 |
stringOrNumber may be a number, a selector from the selectorArray |
|
593 | 1322 |
or a string from the title array. |
1323 |
If stringOrNumber is not a valid item, return 0." |
|
91 | 1324 |
|
1325 |
|idx| |
|
0 | 1326 |
|
91 | 1327 |
stringOrNumber isNumber ifTrue:[ |
593 | 1328 |
^ stringOrNumber |
0 | 1329 |
]. |
91 | 1330 |
selectors notNil ifTrue:[ |
593 | 1331 |
idx := selectors indexOf:stringOrNumber. |
1332 |
idx ~~ 0 ifTrue:[^ idx]. |
|
1333 |
]. |
|
1334 |
stringOrNumber isString ifTrue:[ |
|
1335 |
^ titles indexOf:stringOrNumber |
|
91 | 1336 |
]. |
593 | 1337 |
(stringOrNumber respondsTo:#string) ifTrue:[ |
1338 |
^ titles indexOf:stringOrNumber asString |
|
1339 |
]. |
|
1340 |
^ 0 |
|
1341 |
||
1342 |
"Modified: 27.4.1996 / 15:25:28 / cg" |
|
0 | 1343 |
! |
1344 |
||
542 | 1345 |
performEntry:itemIndex |
1346 |
|block sel model| |
|
1347 |
||
1348 |
actions notNil ifTrue:[ |
|
1349 |
block := actions at:itemIndex. |
|
1350 |
block notNil ifTrue:[ |
|
1351 |
block value. |
|
1352 |
^ self |
|
1353 |
]. |
|
1354 |
]. |
|
1355 |
selectors notNil ifTrue:[ |
|
1356 |
sel := selectors at:itemIndex. |
|
1357 |
sel notNil ifTrue:[ |
|
1358 |
model notNil ifTrue:[ |
|
1359 |
model perform:sel |
|
1360 |
] ifFalse:[ |
|
1361 |
receiver perform:sel |
|
1362 |
] |
|
1363 |
]. |
|
1364 |
]. |
|
1365 |
||
1366 |
"Modified: 17.4.1996 / 20:55:11 / cg" |
|
1367 |
! |
|
1368 |
||
1369 |
performSelectedAction |
|
1370 |
|block sel| |
|
1371 |
||
1372 |
actions notNil ifTrue:[ |
|
1373 |
block := actions at:activeMenuNumber. |
|
1374 |
block notNil ifTrue:[ |
|
1375 |
block value. |
|
1376 |
^ self |
|
1377 |
]. |
|
1378 |
]. |
|
1379 |
selectors notNil ifTrue:[ |
|
1380 |
sel := selectors at:activeMenuNumber. |
|
1381 |
sel notNil ifTrue:[ |
|
1382 |
model notNil ifTrue:[ |
|
1383 |
model perform:sel |
|
1384 |
] ifFalse:[ |
|
1385 |
receiver perform:sel |
|
1386 |
] |
|
1387 |
]. |
|
1388 |
]. |
|
1389 |
||
1390 |
"Modified: 17.4.1996 / 20:55:11 / cg" |
|
1391 |
"Created: 17.4.1996 / 20:55:53 / cg" |
|
1392 |
! |
|
1393 |
||
202 | 1394 |
setMenuOrigins |
1395 |
"adjust origins of menus when font changes" |
|
1396 |
||
1397 |
(font device == device) ifTrue:[ |
|
516 | 1398 |
menus notNil ifTrue:[ |
1399 |
menus keysAndValuesDo:[:index :aMenu | |
|
1400 |
aMenu notNil ifTrue:[ |
|
1401 |
aMenu origin:((left + (self titleLenUpTo:index)) |
|
1402 |
@ |
|
1403 |
(height + aMenu borderWidth)) |
|
1404 |
]. |
|
1405 |
] |
|
1406 |
] |
|
202 | 1407 |
] |
516 | 1408 |
|
1409 |
"Modified: 23.3.1996 / 17:18:36 / cg" |
|
202 | 1410 |
! |
1411 |
||
133 | 1412 |
someMenuItemLabeled:aLabel |
1413 |
"find a menu item. |
|
1414 |
Currently, in ST/X, instances of MenuItem are only created as dummy" |
|
1415 |
||
1416 |
|idx| |
|
1417 |
||
1418 |
idx := self indexOf:aLabel. |
|
1419 |
idx ~~ 0 ifTrue:[ |
|
1420 |
^ MenuItem new menu:self index:idx |
|
1421 |
]. |
|
1422 |
menus notNil ifTrue:[ |
|
1423 |
menus do:[:aMenu | |
|
1424 |
|item| |
|
1425 |
||
1426 |
aMenu notNil ifTrue:[ |
|
1427 |
(item := aMenu someMenuItemLabeled:aLabel) notNil ifTrue:[ |
|
1428 |
^ item |
|
1429 |
] |
|
1430 |
] |
|
1431 |
] |
|
1432 |
]. |
|
1433 |
^ nil |
|
1434 |
! |
|
1435 |
||
110 | 1436 |
titleIndexForX:x |
1437 |
"given a click x-position, return index in title or nil" |
|
1438 |
||
1439 |
|xstart "{ Class: SmallInteger }" |
|
1440 |
xend "{ Class: SmallInteger }" |
|
1441 |
wSpace wSep| |
|
1442 |
||
1443 |
wSpace := (font widthOf:' ') * 2. |
|
1444 |
showSeparatingLines ifTrue:[ |
|
1445 |
self is3D ifTrue:[ |
|
1446 |
wSep := 2 |
|
1447 |
] ifFalse:[ |
|
1448 |
wSep := 1 |
|
1449 |
] |
|
1450 |
] ifFalse:[ |
|
1451 |
wSep := 0 |
|
1452 |
]. |
|
1453 |
xstart := 0. |
|
1454 |
1 to:(titles size) do:[:index | |
|
1455 |
|entry thisLength| |
|
1456 |
||
1457 |
entry := titles at:index. |
|
1458 |
entry isString ifTrue:[ |
|
1459 |
thisLength := font widthOf:entry. |
|
1460 |
] ifFalse:[ |
|
1461 |
thisLength := entry width |
|
1462 |
]. |
|
1463 |
xend := xstart + thisLength + wSpace + wSep. |
|
1464 |
(x between:xstart and:xend) ifTrue:[^ index]. |
|
1465 |
xstart := xend |
|
1466 |
]. |
|
1467 |
^ nil |
|
1468 |
! |
|
1469 |
||
202 | 1470 |
titleLenUpTo:index |
1471 |
"answer len (in pixels) of all title-strings up-to |
|
1472 |
(but excluding) title-index. Used to compute x-position when drawing |
|
1473 |
individual entries." |
|
110 | 1474 |
|
202 | 1475 |
|len "{ Class: SmallInteger }" |
1476 |
wSpace wSep| |
|
110 | 1477 |
|
202 | 1478 |
(index <= 1) ifTrue:[^ 0]. |
1479 |
wSpace := (font widthOf:' '). |
|
1480 |
showSeparatingLines ifTrue:[ |
|
1481 |
self is3D ifTrue:[ |
|
1482 |
wSep := 2 |
|
1483 |
] ifFalse:[ |
|
1484 |
wSep := 1 |
|
1485 |
] |
|
1486 |
] ifFalse:[ |
|
1487 |
wSep := 0 |
|
133 | 1488 |
]. |
1489 |
||
202 | 1490 |
len := 0. |
1491 |
titles from:1 to:(index - 1) do:[:entry | |
|
1492 |
|thisLength| |
|
128 | 1493 |
|
202 | 1494 |
entry isString ifTrue:[ |
1495 |
thisLength := (font widthOf:entry). |
|
1496 |
] ifFalse:[ |
|
1497 |
thisLength := entry width |
|
131 | 1498 |
]. |
202 | 1499 |
len := len + thisLength + wSpace + wSep + wSpace. |
110 | 1500 |
]. |
202 | 1501 |
^ len |
110 | 1502 |
! ! |
1503 |
||
202 | 1504 |
!PullDownMenu methodsFor:'queries'! |
110 | 1505 |
|
202 | 1506 |
preferredExtent |
572 | 1507 |
"return my preferredExtent from the title-item widths & font height" |
1508 |
||
202 | 1509 |
|w| |
0 | 1510 |
|
714
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
1511 |
preferredExtent notNil ifTrue:[ |
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
1512 |
^ preferredExtent |
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
1513 |
]. |
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
1514 |
|
202 | 1515 |
w := self titleLenUpTo:(titles size + 1). |
1516 |
^ w @ (font height + (font descent * 2) "+ topMargin" + (margin*2)). |
|
572 | 1517 |
|
714
5ff02d2d9fa7
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
1518 |
"Modified: 29.5.1996 / 12:11:11 / cg" |
110 | 1519 |
! ! |
0 | 1520 |
|
110 | 1521 |
!PullDownMenu methodsFor:'submenu notifications'! |
0 | 1522 |
|
465
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1523 |
hideSubmenu |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1524 |
"sent by en escaped menu - ignored here" |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1525 |
|
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1526 |
^ self |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1527 |
|
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1528 |
"Modified: 4.3.1996 / 22:58:22 / cg" |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1529 |
! |
b473edeab54e
can now be controlled by keyboard
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1530 |
|
110 | 1531 |
showActive |
128 | 1532 |
"sent by a menu to tell me that it starts to perform |
1533 |
its menu action." |
|
131 | 1534 |
|
1535 |
windowGroup notNil ifTrue:[windowGroup showCursor:Cursor wait] |
|
38 | 1536 |
! |
1537 |
||
110 | 1538 |
showPassive |
128 | 1539 |
"sent by a menu to tell me that it finished its menu-action. |
1540 |
Here, we hide the currently active menu." |
|
0 | 1541 |
|
131 | 1542 |
self hideActiveMenu. |
1543 |
windowGroup notNil ifTrue:[windowGroup restoreCursors] |
|
77 | 1544 |
! |
1545 |
||
110 | 1546 |
submenuTriggered |
1547 |
"sent by a sub-submenu to tell me that it finished its menu-action." |
|
1548 |
||
1549 |
self showPassive |
|
0 | 1550 |
! ! |
1551 |
||
205 | 1552 |
!PullDownMenu class methodsFor:'documentation'! |
1553 |
||
1554 |
version |
|
760 | 1555 |
^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.60 1996-06-12 12:55:00 cg Exp $' |
205 | 1556 |
! ! |