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