78 onLevel <Integer> 3D level of entry-buttons when pressed |
78 onLevel <Integer> 3D level of entry-buttons when pressed |
79 offLevel <Integer> 3D level of entry-buttons when released |
79 offLevel <Integer> 3D level of entry-buttons when released |
80 |
80 |
81 edgeStyle <Symbol> how to draw edges |
81 edgeStyle <Symbol> how to draw edges |
82 |
82 |
83 keepmenu <Boolean> if on, pulled menu stays on click, |
83 toggleMode <Symbol> if #toggle, press pulls menu, |
84 till clicked again (motif & windows behavior) |
84 another press hides it. |
85 |
85 if other, its hidden on release. |
86 toggleKeep <Boolean> if on and keepMenu is on, |
|
87 clicking again on label closes menu |
|
88 |
86 |
89 except menus, titles and selectors, instvars are usually defined from |
87 except menus, titles and selectors, instvars are usually defined from |
90 defaults in the styleSheet; you should not care for them. |
88 defaults in the styleSheet; you should not care for them. |
91 |
89 |
92 |
90 |
93 [StyleSheet values:] |
91 [StyleSheet values:] |
94 |
92 |
95 pullDownMenuViewBackground view background Color for the menu bar |
93 pullDownMenuViewBackground view background Color for the menu bar |
96 default: menuViewBackground |
94 default: menuViewBackground |
97 |
95 |
98 pullDownMenuForegroundColor foreground drawing color for the menu bar |
96 pullDownMenuForegroundColor foreground drawing color for the menu bar |
99 default: menuForegroundColor |
97 default: menuForegroundColor |
100 |
98 |
101 pullDownMenuBackgroundColor background drawing color for the menu bar |
99 pullDownMenuBackgroundColor background drawing color for the menu bar |
102 default: menuBackgroundColor |
100 default: menuBackgroundColor |
103 |
101 |
104 pullDownMenuHilightForegroundColor active foreground drawing color for the menu bar |
102 pullDownMenuHilightForegroundColor active foreground drawing color for the menu bar |
105 default: menuHilightForegroundColor |
103 default: menuHilightForegroundColor |
106 |
104 |
107 pullDownMenuHilightBackgroundColor active background drawing color for the menu bar |
105 pullDownMenuHilightBackgroundColor active background drawing color for the menu bar |
108 default: menuHilightBackgroundColor |
106 default: menuHilightBackgroundColor |
109 |
107 |
110 pullDownMenuHilightLevel level (3D only) when active |
108 pullDownMenuHilightLevel level (3D only) when active |
111 default: menuHilightLevel |
109 default: menuHilightLevel |
112 |
110 |
113 pullDownMenuEdgeStyle edge style (nil or #soft) |
111 pullDownMenuEdgeStyle edge style (nil or #soft) |
114 |
112 |
115 pullDownMenuKeepMenu if true, pulled menu stays open until button |
113 pullDownMenuKeepMenu if true, pulled menu stays open until button |
116 is pressed again outside of the item-area (motif behavior) |
114 is pressed again outside of the item-area (motif behavior) |
117 if false, menu closes on release (default) |
115 if false, menu closes on release (default) |
118 |
116 |
119 pullDownMenuToggleKeep if true, pulled menu closes when an entry is pressed |
117 pullDownMenuToggleKeep if true, pulled menu closes when an entry is pressed |
120 again. Otherwise, only press outside of the items area |
118 again. Otherwise, only press outside of the items area |
121 hides it. default is false |
119 hides it. default is false |
122 |
120 |
123 pullDownMenuLevel level (3D only) |
121 pullDownMenuLevel level (3D only) |
124 |
122 |
125 pullDownMenuFont font to use for the menu bar |
123 pullDownMenuFont font to use for the menu bar |
126 default: menuFont |
124 default: menuFont |
127 |
125 |
128 pullDownMenuShowSeparatingLines if true, lines are drawn between items. |
126 pullDownMenuShowSeparatingLines if true, lines are drawn between items. |
129 default: false |
127 default: false |
130 |
128 |
131 pullDownMenuRaiseTop if true, topview is raised whenever an entry |
129 pullDownMenuRaiseTop if true, topview is raised whenever an entry |
132 is activated. |
130 is activated. |
133 default: true |
131 default: true |
134 |
132 |
135 [author:] |
133 [author:] |
136 Claus Gittinger |
134 Claus Gittinger |
137 " |
135 " |
138 ! |
136 ! |
139 |
137 |
140 examples |
138 examples |
141 " |
139 " |
142 with default level (from styleSheets 'pullDownMenuLevel' setting): |
140 with default level (from styleSheets 'pullDownMenuLevel' setting): |
143 [exBegin] |
141 [exBegin] |
144 |top menu| |
142 |top menu| |
145 |
143 |
146 top := StandardSystemView new. |
144 top := StandardSystemView new. |
147 top extent:300@300. |
145 top extent:300@300. |
148 |
146 |
149 menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
147 menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
150 menu labels:#('foo' 'bar'). |
148 menu labels:#('foo' 'bar'). |
151 menu selectors:#(foo bar). |
149 menu selectors:#(foo bar). |
152 menu at:#foo |
150 menu at:#foo |
153 putLabels:#('foo1' 'foo2' 'foo3') |
151 putLabels:#('foo1' 'foo2' 'foo3') |
154 selectors:#(foo1 foo2 foo3) |
152 selectors:#(foo1 foo2 foo3) |
155 receiver:nil. |
153 receiver:nil. |
156 menu at:#bar |
154 menu at:#bar |
157 putLabels:#('bar1' 'bar2' 'bar3') |
155 putLabels:#('bar1' 'bar2' 'bar3') |
158 selectors:#(bar1 bar2 bar3) |
156 selectors:#(bar1 bar2 bar3) |
159 receiver:nil. |
157 receiver:nil. |
160 top open |
158 top open |
161 [exEnd] |
159 [exEnd] |
162 |
160 |
163 with a defined level: |
161 with a defined level: |
164 [exBegin] |
162 [exBegin] |
165 |top menu| |
163 |top menu| |
166 |
164 |
167 top := StandardSystemView new. |
165 top := StandardSystemView new. |
168 top extent:300@300. |
166 top extent:300@300. |
169 |
167 |
170 menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
168 menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
171 menu level:1. |
169 menu level:1. |
172 menu labels:#('foo' 'bar'). |
170 menu labels:#('foo' 'bar'). |
173 menu selectors:#(foo bar). |
171 menu selectors:#(foo bar). |
174 menu at:#foo |
172 menu at:#foo |
175 putLabels:#('foo1' 'foo2' 'foo3') |
173 putLabels:#('foo1' 'foo2' 'foo3') |
176 selectors:#(foo1 foo2 foo3) |
174 selectors:#(foo1 foo2 foo3) |
177 receiver:nil. |
175 receiver:nil. |
178 menu at:#bar |
176 menu at:#bar |
179 putLabels:#('bar1' 'bar2' 'bar3') |
177 putLabels:#('bar1' 'bar2' 'bar3') |
180 selectors:#(bar1 bar2 bar3) |
178 selectors:#(bar1 bar2 bar3) |
181 receiver:nil. |
179 receiver:nil. |
182 top open |
180 top open |
183 [exEnd] |
181 [exEnd] |
184 |
182 |
185 |
183 |
186 empty entries are possible as selectable items (with non-nil seletor) ... |
184 empty entries are possible as selectable items (with non-nil seletor) ... |
187 [exBegin] |
185 [exBegin] |
188 |top menu| |
186 |top menu| |
189 |
187 |
190 top := StandardSystemView new. |
188 top := StandardSystemView new. |
191 top extent:300@300. |
189 top extent:300@300. |
192 |
190 |
193 menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
191 menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
194 menu labels:#('foo' 'bar' 'baz'). |
192 menu labels:#('foo' 'bar' 'baz'). |
195 menu selectors:#(foo bar baz). |
193 menu selectors:#(foo bar baz). |
196 menu at:#foo |
194 menu at:#foo |
197 putLabels:#('foo1' 'foo2' 'foo3') |
195 putLabels:#('foo1' 'foo2' 'foo3') |
198 selectors:#(foo1 foo2 foo3) |
196 selectors:#(foo1 foo2 foo3) |
199 receiver:nil. |
197 receiver:nil. |
200 menu at:#baz |
198 menu at:#baz |
201 putLabels:#('baz1' 'baz2' 'baz3') |
199 putLabels:#('baz1' 'baz2' 'baz3') |
202 selectors:#(baz1 baz2 baz3) |
200 selectors:#(baz1 baz2 baz3) |
203 receiver:nil. |
201 receiver:nil. |
204 top open |
202 top open |
205 [exEnd] |
203 [exEnd] |
206 |
204 |
207 |
205 |
208 ... or as separators (with nil selector) |
206 ... or as separators (with nil selector) |
209 [exBegin] |
207 [exBegin] |
210 |top menu| |
208 |top menu| |
211 |
209 |
212 top := StandardSystemView new. |
210 top := StandardSystemView new. |
213 top extent:500@200. |
211 top extent:500@200. |
214 |
212 |
215 menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
213 menu := PullDownMenu origin:0.0@0.0 corner:1.0@30 in:top. |
216 menu labels:#('foo' ' ' 'bar' ' baz' ' ' 'moreFoo' 'moreBar' 'moreBaz'). |
214 menu labels:#('foo' ' ' 'bar' ' baz' ' ' 'moreFoo' 'moreBar' 'moreBaz'). |
217 menu selectors:#(foo nil bar baz nil moreFoo moreBar moreBaz). |
215 menu selectors:#(foo nil bar baz nil moreFoo moreBar moreBaz). |
218 menu at:#foo |
216 menu at:#foo |
219 putLabels:#('foo1' 'foo2' 'foo3') |
217 putLabels:#('foo1' 'foo2' 'foo3') |
220 selectors:#(foo1 foo2 foo3) |
218 selectors:#(foo1 foo2 foo3) |
221 receiver:nil. |
219 receiver:nil. |
222 menu at:#bar |
220 menu at:#bar |
223 putLabels:#('bar1' 'bar2' 'bar3') |
221 putLabels:#('bar1' 'bar2' 'bar3') |
224 selectors:#(bar1 bar2 bar3) |
222 selectors:#(bar1 bar2 bar3) |
225 receiver:nil. |
223 receiver:nil. |
226 menu at:#baz |
224 menu at:#baz |
227 putLabels:#('baz1' 'baz2' 'baz3') |
225 putLabels:#('baz1' 'baz2' 'baz3') |
228 selectors:#(baz1 baz2 baz3) |
226 selectors:#(baz1 baz2 baz3) |
229 receiver:nil. |
227 receiver:nil. |
230 top open |
228 top open |
231 [exEnd] |
229 [exEnd] |
232 |
230 |
233 |
231 |
234 |
232 |
235 use the menus default height |
233 use the menus default height |
236 [exBegin] |
234 [exBegin] |
237 |top menu| |
235 |top menu| |
238 |
236 |
239 top := StandardSystemView new. |
237 top := StandardSystemView new. |
240 top extent:300@300. |
238 top extent:300@300. |
241 |
239 |
242 menu := PullDownMenu in:top. |
240 menu := PullDownMenu in:top. |
243 menu origin:0.0@0.0 corner:1.0@(menu height). |
241 menu origin:0.0@0.0 corner:1.0@(menu height). |
244 menu labels:#('foo' 'bar'). |
242 menu labels:#('foo' 'bar'). |
245 menu selectors:#(foo bar). |
243 menu selectors:#(foo bar). |
246 menu at:#foo |
244 menu at:#foo |
247 putLabels:#('foo1' 'foo2' 'foo3') |
245 putLabels:#('foo1' 'foo2' 'foo3') |
248 selectors:#(foo1 foo2 foo3) |
246 selectors:#(foo1 foo2 foo3) |
249 receiver:nil. |
247 receiver:nil. |
250 top open |
248 top open |
251 [exEnd] |
249 [exEnd] |
252 |
250 |
253 |
251 |
254 |
252 |
255 although you can change the font, colors etc. (as shown below) |
253 although you can change the font, colors etc. (as shown below) |
256 you should NOT do it - since if you do so, the styleSheet settings |
254 you should NOT do it - since if you do so, the styleSheet settings |
257 are ineffective (which users probably won't like) |
255 are ineffective (which users probably won't like) |
258 BTW: The styleSheet entries for below are pullDownMenuForegroundColor, |
256 BTW: The styleSheet entries for below are pullDownMenuForegroundColor, |
259 pullDownMenuBackgroundColor and pullDownMenuFont |
257 pullDownMenuBackgroundColor and pullDownMenuFont |
260 [exBegin] |
258 [exBegin] |
261 |top menu| |
259 |top menu| |
262 |
260 |
263 top := StandardSystemView new. |
261 top := StandardSystemView new. |
264 menu := PullDownMenu in:top. |
262 menu := PullDownMenu in:top. |
265 menu font:(Font family:'courier' size:20). |
263 menu font:(Font family:'courier' size:20). |
266 menu foregroundColor:Color red. |
264 menu foregroundColor:Color red. |
267 menu backgroundColor:Color yellow. |
265 menu backgroundColor:Color yellow. |
268 menu viewBackground:Color green. |
266 menu viewBackground:Color green. |
269 menu showSeparatingLines:true. |
267 menu showSeparatingLines:true. |
270 |
268 |
271 menu origin:0.0@0.0 corner:1.0@(menu height). |
269 menu origin:0.0@0.0 corner:1.0@(menu height). |
272 menu labels:#('foo' 'bar'). |
270 menu labels:#('foo' 'bar'). |
273 menu selectors:#(foo bar). |
271 menu selectors:#(foo bar). |
274 menu at:#foo |
272 menu at:#foo |
275 putLabels:#('foo1' 'foo2' 'foo3') |
273 putLabels:#('foo1' 'foo2' 'foo3') |
276 selectors:#(foo1 foo2 foo3) |
274 selectors:#(foo1 foo2 foo3) |
277 receiver:nil. |
275 receiver:nil. |
278 (menu menuAt:#foo) font:(Font family:'courier' size:36). |
276 (menu menuAt:#foo) font:(Font family:'courier' size:36). |
279 top open |
277 top open |
280 [exEnd] |
278 [exEnd] |
281 |
279 |
282 |
280 |
283 you can use icons, too ... |
281 you can use icons, too ... |
284 [exBegin] |
282 [exBegin] |
285 |labels top menu| |
283 |labels top menu| |
286 |
284 |
287 top := StandardSystemView new. |
285 top := StandardSystemView new. |
288 top extent:300@300. |
286 top extent:300@300. |
289 |
287 |
290 menu := PullDownMenu in:top. |
288 menu := PullDownMenu in:top. |
291 menu origin:0.0@0.0 corner:1.0@(menu height). |
289 menu origin:0.0@0.0 corner:1.0@(menu height). |
292 labels := Array with:((Image fromFile:'SmalltalkX.xbm') magnifiedTo:16@16) |
290 labels := Array with:((Image fromFile:'SmalltalkX.xbm') magnifiedTo:16@16) |
293 with:'foo' |
291 with:'foo' |
294 with:'bar'. |
292 with:'bar'. |
295 menu labels:labels. |
293 menu labels:labels. |
296 menu selectors:#(about foo bar). |
294 menu selectors:#(about foo bar). |
297 menu at:#about |
295 menu at:#about |
298 putLabels:#('about PullDownMenus') |
296 putLabels:#('about PullDownMenus') |
299 selectors:#(aboutMenus) |
297 selectors:#(aboutMenus) |
300 receiver:nil. |
298 receiver:nil. |
301 menu at:#foo |
299 menu at:#foo |
302 putLabels:#('foo1' 'foo2' 'foo3') |
300 putLabels:#('foo1' 'foo2' 'foo3') |
303 selectors:#(foo1 foo2 foo3) |
301 selectors:#(foo1 foo2 foo3) |
304 receiver:nil. |
302 receiver:nil. |
305 top open |
303 top open |
306 [exEnd] |
304 [exEnd] |
307 |
305 |
308 |
306 |
309 a concrete example (combining things described above) |
307 a concrete example (combining things described above) |
310 (using a Plug, since we have no application class here): |
308 (using a Plug, since we have no application class here): |
311 [exBegin] |
309 [exBegin] |
312 |labels top menu textView appModel| |
310 |labels top menu textView appModel| |
313 |
311 |
314 appModel := Plug new. |
312 appModel := Plug new. |
315 appModel respondTo:#quit with:[top destroy]. |
313 appModel respondTo:#quit with:[top destroy]. |
316 appModel respondTo:#showAbout with:[self information:'some info here ...']. |
314 appModel respondTo:#showAbout with:[self information:'some info here ...']. |
317 appModel respondTo:#help with:[self information:'some help here ...']. |
315 appModel respondTo:#help with:[self information:'some help here ...']. |
318 |
316 |
319 top := StandardSystemView new. |
317 top := StandardSystemView new. |
320 top extent:300@300. |
318 top extent:300@300. |
321 |
319 |
322 menu := PullDownMenu in:top. |
320 menu := PullDownMenu in:top. |
323 menu receiver:appModel. |
321 menu receiver:appModel. |
324 menu origin:0.0@0.0 corner:1.0@(menu height). |
322 menu origin:0.0@0.0 corner:1.0@(menu height). |
325 |
323 |
326 textView := ScrollableView forView:(EditTextView new). |
324 textView := ScrollableView forView:(EditTextView new). |
327 textView origin:0.0@menu height corner:1.0@1.0. |
325 textView origin:0.0@menu height corner:1.0@1.0. |
328 top addSubView:textView. |
326 top addSubView:textView. |
329 |
327 |
330 labels := Array with:((Image fromFile:'SmalltalkX.xbm') magnifiedTo:16@16) |
328 labels := Array with:((Image fromFile:'SmalltalkX.xbm') magnifiedTo:16@16) |
331 with:'file' |
329 with:'file' |
332 with:'edit' |
330 with:'edit' |
333 with:'help'. |
331 with:'help'. |
334 menu labels:labels. |
332 menu labels:labels. |
335 menu selectors:#(about file edit help). |
333 menu selectors:#(about file edit help). |
336 menu at:#about |
334 menu at:#about |
337 putLabels:#('about PullDownMenus') |
335 putLabels:#('about PullDownMenus') |
338 selectors:#(showAbout) |
336 selectors:#(showAbout) |
339 receiver:appModel. |
337 receiver:appModel. |
340 menu at:#file |
338 menu at:#file |
341 putLabels:#('quit') |
339 putLabels:#('quit') |
342 selectors:#(quit) |
340 selectors:#(quit) |
343 receiver:appModel. |
341 receiver:appModel. |
344 menu at:#edit |
342 menu at:#edit |
345 putLabels:#('copy' 'cut' 'paste') |
343 putLabels:#('copy' 'cut' 'paste') |
346 selectors:#(copySelection cut paste) |
344 selectors:#(copySelection cut paste) |
347 receiver:textView. |
345 receiver:textView. |
348 top open |
346 top open |
349 [exEnd] |
347 [exEnd] |
350 " |
348 " |
351 |
349 |
352 ! ! |
350 ! ! |
353 |
351 |
354 !PullDownMenu class methodsFor:'instance creation'! |
352 !PullDownMenu class methodsFor:'instance creation'! |
363 |
361 |
364 updateStyleCache |
362 updateStyleCache |
365 "extract values from the styleSheet and cache them in class variables" |
363 "extract values from the styleSheet and cache them in class variables" |
366 |
364 |
367 <resource: #style (#'pullDownMenu.viewBackground' #'menuView.background' |
365 <resource: #style (#'pullDownMenu.viewBackground' #'menuView.background' |
368 #'pullDownMenu.foregroundColor' #'menu.foregroundColor' |
366 #'pullDownMenu.foregroundColor' #'menu.foregroundColor' |
369 #'pullDownMenu.backgroundColor' #'menu.backgroundColor' |
367 #'pullDownMenu.backgroundColor' #'menu.backgroundColor' |
370 #'pullDownMenu.hilightForegroundColor' #'menu.hilightForegroundColor' |
368 #'pullDownMenu.hilightForegroundColor' #'menu.hilightForegroundColor' |
371 #'pullDownMenu.hilightBackgroundColor' #'menu.hilightBackgroundColor' |
369 #'pullDownMenu.hilightBackgroundColor' #'menu.hilightBackgroundColor' |
372 #'pullDownMenu.hilightLevel' #'menu.hilightLevel' |
370 #'pullDownMenu.hilightLevel' #'menu.hilightLevel' |
373 #'pullDownMenu.edgeStyle' #'pullDownMenu.keepMenu' |
371 #'pullDownMenu.edgeStyle' |
374 #'pullDownMenu.toggleKeep' #'pullDownMenu.level' |
372 #'pullDownMenu.toggleMode' |
375 #'pullDownMenu.font' #'menu.font' |
373 #'pullDownMenu.level' |
376 #'pullDownMenu.separatingLines')> |
374 #'pullDownMenu.font' #'menu.font' |
|
375 #'pullDownMenu.separatingLines')> |
377 |
376 |
378 |styleSheet| |
377 |styleSheet| |
379 |
378 |
380 styleSheet := StyleSheet. |
379 styleSheet := StyleSheet. |
381 |
380 |
382 DefaultViewBackground := styleSheet colorAt:'pullDownMenu.viewBackground'. |
381 DefaultViewBackground := styleSheet colorAt:'pullDownMenu.viewBackground'. |
383 DefaultViewBackground isNil ifTrue:[ |
382 DefaultViewBackground isNil ifTrue:[ |
384 DefaultViewBackground := styleSheet colorAt:'menuView.background'. |
383 DefaultViewBackground := styleSheet colorAt:'menuView.background'. |
385 ]. |
384 ]. |
386 DefaultForegroundColor := styleSheet colorAt:'pullDownMenu.foregroundColor'. |
385 DefaultForegroundColor := styleSheet colorAt:'pullDownMenu.foregroundColor'. |
387 DefaultForegroundColor isNil ifTrue:[ |
386 DefaultForegroundColor isNil ifTrue:[ |
388 DefaultForegroundColor := styleSheet colorAt:'menu.foregroundColor'. |
387 DefaultForegroundColor := styleSheet colorAt:'menu.foregroundColor'. |
389 ]. |
388 ]. |
390 DefaultBackgroundColor := styleSheet colorAt:'pullDownMenu.backgroundColor'. |
389 DefaultBackgroundColor := styleSheet colorAt:'pullDownMenu.backgroundColor'. |
391 DefaultBackgroundColor isNil ifTrue:[ |
390 DefaultBackgroundColor isNil ifTrue:[ |
392 DefaultViewBackground notNil ifTrue:[ |
391 DefaultViewBackground notNil ifTrue:[ |
393 DefaultBackgroundColor := DefaultViewBackground |
392 DefaultBackgroundColor := DefaultViewBackground |
394 ] ifFalse:[ |
393 ] ifFalse:[ |
395 DefaultBackgroundColor := styleSheet colorAt:'menu.backgroundColor'. |
394 DefaultBackgroundColor := styleSheet colorAt:'menu.backgroundColor'. |
396 ] |
395 ] |
397 ]. |
396 ]. |
398 DefaultHilightForegroundColor := styleSheet colorAt:'pullDownMenu.hilightForegroundColor'. |
397 DefaultHilightForegroundColor := styleSheet colorAt:'pullDownMenu.hilightForegroundColor'. |
399 DefaultHilightForegroundColor isNil ifTrue:[ |
398 DefaultHilightForegroundColor isNil ifTrue:[ |
400 DefaultHilightForegroundColor := styleSheet colorAt:'menu.hilightForegroundColor'. |
399 DefaultHilightForegroundColor := styleSheet colorAt:'menu.hilightForegroundColor'. |
401 ]. |
400 ]. |
402 DefaultHilightBackgroundColor := styleSheet colorAt:'pullDownMenu.hilightBackgroundColor'. |
401 DefaultHilightBackgroundColor := styleSheet colorAt:'pullDownMenu.hilightBackgroundColor'. |
403 DefaultHilightBackgroundColor isNil ifTrue:[ |
402 DefaultHilightBackgroundColor isNil ifTrue:[ |
404 DefaultHilightBackgroundColor := styleSheet colorAt:'menu.hilightBackgroundColor'. |
403 DefaultHilightBackgroundColor := styleSheet colorAt:'menu.hilightBackgroundColor'. |
405 ]. |
404 ]. |
406 DefaultHilightLevel := styleSheet at:'pullDownMenu.hilightLevel'. |
405 DefaultHilightLevel := styleSheet at:'pullDownMenu.hilightLevel'. |
407 DefaultHilightLevel isNil ifTrue:[ |
406 DefaultHilightLevel isNil ifTrue:[ |
408 DefaultHilightLevel := styleSheet at:'menu.hilightLevel' default:0. |
407 DefaultHilightLevel := styleSheet at:'menu.hilightLevel' default:0. |
409 ]. |
408 ]. |
410 DefaultEdgeStyle := styleSheet at:'pullDownMenu.edgeStyle'. |
409 DefaultEdgeStyle := styleSheet at:'pullDownMenu.edgeStyle'. |
411 DefaultKeepMenu := styleSheet at:'pullDownMenu.keepMenu' default:false. |
410 DefaultToggleMode := styleSheet at:'pullDownMenu.toggleMode' default:#toggle. |
412 DefaultToggleKeep := styleSheet at:'pullDownMenu.toggleKeep' default:false. |
|
413 DefaultLevel := styleSheet at:'pullDownMenu.level' default:1. |
411 DefaultLevel := styleSheet at:'pullDownMenu.level' default:1. |
414 DefaultFont := styleSheet fontAt:'pullDownMenu.font'. |
412 DefaultFont := styleSheet fontAt:'pullDownMenu.font'. |
415 DefaultFont isNil ifTrue:[DefaultFont := styleSheet fontAt:'menu.font']. |
413 DefaultFont isNil ifTrue:[DefaultFont := styleSheet fontAt:'menu.font']. |
416 DefaultSeparatingLines := styleSheet at:'pullDownMenu.separatingLines' default:false. |
414 DefaultSeparatingLines := styleSheet at:'pullDownMenu.separatingLines' default:false. |
417 |
415 |
1005 !PullDownMenu methodsFor:'event handling'! |
1003 !PullDownMenu methodsFor:'event handling'! |
1006 |
1004 |
1007 buttonMotion:state x:x y:y |
1005 buttonMotion:state x:x y:y |
1008 |titleIndex activeMenu activeLeft activeTop| |
1006 |titleIndex activeMenu activeLeft activeTop| |
1009 |
1007 |
1010 state == 0 ifTrue:[^ self]. |
1008 state == 0 ifTrue:[ |
|
1009 self hideActiveMenu. |
|
1010 ^ self |
|
1011 ]. |
|
1012 |
|
1013 activeMenuNumber isNil ifTrue:[^ self]. |
1011 |
1014 |
1012 activeMenuNumber notNil ifTrue:[ |
1015 activeMenuNumber notNil ifTrue:[ |
1013 activeMenu := menus at:activeMenuNumber. |
1016 activeMenu := menus at:activeMenuNumber. |
1014 ]. |
1017 ]. |
1015 |
1018 |
1016 (y < height) ifTrue:[ |
1019 (y < height) ifTrue:[ |
1017 "moving around in title line" |
1020 "moving around in title line" |
1018 activeMenu notNil ifTrue:[ |
1021 activeMenu notNil ifTrue:[ |
1019 activeMenu setSelection:nil |
1022 activeMenu setSelection:nil |
1020 ]. |
1023 ]. |
1021 titleIndex := self titleIndexForX:x. |
1024 titleIndex := self titleIndexForX:x. |
1022 titleIndex notNil ifTrue:[ |
1025 titleIndex notNil ifTrue:[ |
1023 (titleIndex ~~ activeMenuNumber) ifTrue:[ |
1026 (titleIndex ~~ activeMenuNumber) ifTrue:[ |
1024 self pullMenu:titleIndex |
1027 self pullMenu:titleIndex |
1025 ] |
1028 ] |
1026 ] ifFalse:[ |
1029 ] ifFalse:[ |
1027 self hideActiveMenu |
1030 self hideActiveMenu |
1028 ] |
1031 ] |
1029 ] ifFalse:[ |
1032 ] ifFalse:[ |
1030 "moving around below" |
1033 "moving around below" |
1031 activeMenu isNil ifTrue:[^self]. |
1034 activeMenu isNil ifTrue:[^self]. |
1032 activeLeft := activeMenu left. |
1035 activeLeft := activeMenu left. |
1033 (x between:activeLeft and:(activeMenu right)) ifTrue:[ |
1036 (x between:activeLeft and:(activeMenu right)) ifTrue:[ |
1034 activeTop := activeMenu top. |
1037 activeTop := activeMenu top. |
1035 (y between:activeTop and:(activeMenu bottom)) ifTrue:[ |
1038 (y between:activeTop and:(activeMenu bottom)) ifTrue:[ |
1036 "moving around in menu" |
1039 "moving around in menu" |
1037 activeMenu buttonMotion:state |
1040 activeMenu buttonMotion:state |
1038 x:(x - activeLeft) |
1041 x:(x - activeLeft) |
1039 y:(y - activeTop). |
1042 y:(y - activeTop). |
1040 ^ self |
1043 ^ self |
1041 ] |
1044 ] |
1042 ]. |
1045 ]. |
1043 "moved outside menu" |
1046 "moved outside menu" |
1044 activeMenu setSelection:nil |
1047 activeMenu setSelection:nil |
1045 ] |
1048 ] |
1046 |
1049 |
1047 "Modified: 25.5.1996 / 12:28:32 / cg" |
1050 "Modified: 25.5.1996 / 12:28:32 / cg" |
1048 ! |
1051 ! |
1049 |
1052 |
1050 buttonPress:button x:x y:y |
1053 buttonPress:button x:x y:y |
1051 |titleIndex activeMenu activeLeft activeTop m| |
1054 |titleIndex activeMenu activeLeft activeTop m| |
1052 |
1055 |
1053 device ungrabPointer. |
1056 device ungrabPointer. |
1054 device ungrabKeyboard. |
1057 device ungrabKeyboard. |
1055 |
1058 |
1056 (y between:0 and:height) ifTrue:[ |
1059 (y between:0 and:height) ifTrue:[ |
1057 titleIndex := self titleIndexForX:x. |
1060 titleIndex := self titleIndexForX:x. |
1058 ]. |
1061 ]. |
1059 |
1062 |
1060 " |
1063 " |
1061 now, titleIndex is non-nil if pressed within myself |
1064 now, titleIndex is non-nil if pressed within myself |
1062 " |
1065 " |
1063 (titleIndex notNil and:[titleIndex ~~ activeMenuNumber]) ifTrue:[ |
1066 (titleIndex notNil and:[titleIndex ~~ activeMenuNumber]) ifTrue:[ |
1064 m := self pullMenu:titleIndex. |
1067 "/ pressed on another item |
1065 (keepMenu and:[m notNil]) ifTrue:[ |
1068 m := self pullMenu:titleIndex. |
1066 device grabPointerInView:self. |
1069 (toggleMode == #toggle) ifTrue:[ |
1067 device grabKeyboardInView:self. |
1070 device grabPointerInView:self. |
|
1071 device grabKeyboardInView:self. |
1068 "/ self cursor:Cursor upRightArrow |
1072 "/ self cursor:Cursor upRightArrow |
1069 ] |
1073 ] |
1070 ] ifFalse:[ |
1074 ] ifFalse:[ |
1071 (keepMenu and:[toggleKeep not]) ifTrue:[ |
1075 titleIndex == activeMenuNumber ifTrue:[ |
1072 titleIndex == activeMenuNumber ifTrue:[ |
1076 "/ pressed on same item |
1073 "same pressed again ... stay" |
1077 (toggleMode ~~ #toggle) ifTrue:[ |
1074 titleIndex notNil ifTrue:[ |
1078 "same pressed again ... stay" |
1075 device grabPointerInView:self. |
1079 titleIndex notNil ifTrue:[ |
1076 device grabKeyboardInView:self. |
1080 device grabPointerInView:self. |
1077 ]. |
1081 device grabKeyboardInView:self. |
1078 ^ self |
1082 ]. |
1079 ]. |
1083 ] ifFalse:[ |
1080 "moving around below" |
1084 self hideActiveMenu. |
1081 activeMenuNumber isNil ifTrue:[^self]. |
1085 ]. |
1082 activeMenu := menus at:activeMenuNumber. |
1086 ^ self |
1083 activeLeft := activeMenu left. |
1087 ]. |
1084 (x between:activeLeft and:(activeMenu right)) ifTrue:[ |
1088 |
1085 activeTop := activeMenu top. |
1089 "/ pressed outside |
1086 (y between:activeTop and:(activeMenu bottom)) ifTrue:[ |
1090 |
1087 "moving around in menu" |
1091 activeMenuNumber isNil ifTrue:[^self]. |
1088 activeMenu buttonPress:button |
1092 |
1089 x:(x - activeLeft) |
1093 activeMenu := menus at:activeMenuNumber. |
1090 y:(y - activeTop). |
1094 activeLeft := activeMenu left. |
1091 ^ self |
1095 (x between:activeLeft and:(activeMenu right)) ifTrue:[ |
1092 ] |
1096 activeTop := activeMenu top. |
1093 ]. |
1097 (y between:activeTop and:(activeMenu bottom)) ifTrue:[ |
1094 ]. |
1098 "/ pressed inside currently pulled menu |
1095 self hideActiveMenu |
1099 activeMenu buttonPress:button x:(x - activeLeft) y:(y - activeTop). |
|
1100 ^ self |
|
1101 ]. |
|
1102 ]. |
|
1103 |
|
1104 "/ somewhere else |
|
1105 self hideActiveMenu |
1096 ] |
1106 ] |
1097 |
1107 |
1098 "Modified: 6.3.1996 / 17:14:16 / cg" |
1108 "Modified: 6.3.1996 / 17:14:16 / cg" |
1099 ! |
1109 ! |
1100 |
1110 |
1154 handle CursorLeft/Right for non-mouse operation |
1164 handle CursorLeft/Right for non-mouse operation |
1155 (for example, if it has the explicit focus) |
1165 (for example, if it has the explicit focus) |
1156 These will pull the previous/next menu |
1166 These will pull the previous/next menu |
1157 " |
1167 " |
1158 ((key == #CursorRight) or:[key == #CursorLeft]) ifTrue:[ |
1168 ((key == #CursorRight) or:[key == #CursorLeft]) ifTrue:[ |
1159 activeMenuNumber isNil ifTrue:[ |
1169 activeMenuNumber isNil ifTrue:[ |
1160 index := (key == #CursorRight) ifTrue:[1] ifFalse:[menus size]. |
1170 index := (key == #CursorRight) ifTrue:[1] ifFalse:[menus size]. |
1161 ] ifFalse:[ |
1171 ] ifFalse:[ |
1162 (key == #CursorRight) ifTrue:[ |
1172 (key == #CursorRight) ifTrue:[ |
1163 index := activeMenuNumber+1 |
1173 "/ if its a cursor-right, and the current item |
1164 ] ifFalse:[ |
1174 "/ has a submenu, then pop up the submenu |
1165 index := activeMenuNumber-1 |
1175 m := menus at:activeMenuNumber. |
1166 ]. |
1176 m notNil ifTrue:[ |
1167 index == 0 ifTrue:[index := menus size] |
1177 m selectedItemHasSubmenu ifTrue:[ |
1168 ifFalse:[ |
1178 m showSubmenu:(m selection). |
1169 index > menus size ifTrue:[index := 1] |
1179 ^ self. |
1170 ] |
1180 ]. |
1171 ]. |
1181 ]. |
1172 self pullMenu:index. |
1182 ]. |
1173 ^ self |
1183 |
|
1184 (key == #CursorRight) ifTrue:[ |
|
1185 index := activeMenuNumber+1 |
|
1186 ] ifFalse:[ |
|
1187 index := activeMenuNumber-1 |
|
1188 ]. |
|
1189 index == 0 ifTrue:[index := menus size] |
|
1190 ifFalse:[ |
|
1191 index > menus size ifTrue:[index := 1] |
|
1192 ] |
|
1193 ]. |
|
1194 self pullMenu:index. |
|
1195 ^ self |
1174 ]. |
1196 ]. |
1175 |
1197 |
1176 "/ activeMenuNumber isNil ifTrue:[ |
1198 "/ activeMenuNumber isNil ifTrue:[ |
1177 "/ |
1199 "/ |
1178 "/ find an item starting with that alpha-key |
1200 "/ find an item starting with that alpha-key |
1179 "/ |
1201 "/ |
1180 key isCharacter ifTrue:[ |
1202 key isCharacter ifTrue:[ |
1181 (key isLetter) ifTrue:[ |
1203 (key isLetter) ifTrue:[ |
1182 activeMenuNumber isNil ifTrue:[ |
1204 activeMenuNumber isNil ifTrue:[ |
1183 startIndex := 1. |
1205 startIndex := 1. |
1184 ] ifFalse:[ |
1206 ] ifFalse:[ |
1185 startIndex := activeMenuNumber + 1 |
1207 startIndex := activeMenuNumber + 1 |
1186 ]. |
1208 ]. |
1187 index := titles |
1209 index := titles |
1188 findFirst:[:item | |
1210 findFirst:[:item | |
1189 item isString |
1211 item isString |
1190 and:[(item startsWith:key asUppercase) |
1212 and:[(item startsWith:key asUppercase) |
1191 or:[item startsWith:key asLowercase]]] |
1213 or:[item startsWith:key asLowercase]]] |
1192 startingAt:startIndex. |
1214 startingAt:startIndex. |
1193 |
1215 |
1194 (index == 0 and:[startIndex ~~ 1]) ifTrue:[ |
1216 (index == 0 and:[startIndex ~~ 1]) ifTrue:[ |
1195 index := titles |
1217 index := titles |
1196 findFirst:[:item | |
1218 findFirst:[:item | |
1197 item isString |
1219 item isString |
1198 and:[(item startsWith:key asUppercase) |
1220 and:[(item startsWith:key asUppercase) |
1199 or:[item startsWith:key asLowercase]]] |
1221 or:[item startsWith:key asLowercase]]] |
1200 startingAt:1. |
1222 startingAt:1. |
1201 ]. |
1223 ]. |
1202 |
1224 |
1203 index ~~ 0 ifTrue:[ |
1225 index ~~ 0 ifTrue:[ |
1204 self pullMenu:index. |
1226 self pullMenu:index. |
1205 ]. |
1227 ]. |
1206 ^ self |
1228 ^ self |
1207 ] |
1229 ] |
1208 ]. |
1230 ]. |
1209 "/ ]. |
1231 "/ ]. |
1210 |
1232 |
1211 activeMenuNumber isNil ifTrue:[ |
1233 activeMenuNumber isNil ifTrue:[ |
1212 ^ super keyPress:key x:x y:y |
1234 ^ super keyPress:key x:x y:y |
1213 ]. |
1235 ]. |
1214 |
1236 |
1215 " |
1237 " |
1216 Return, space or the (virtual) MenuSelect key trigger |
1238 Return, space or the (virtual) MenuSelect key trigger |
1217 a menu entry (for non-submenu entries). |
1239 a menu entry (for non-submenu entries). |
1218 Otherwise, if we have a submenu open, |
1240 Otherwise, if we have a submenu open, |
1219 pass the key on to it ... |
1241 pass the key on to it ... |
1220 " |
1242 " |
1221 m := menus at:activeMenuNumber. |
1243 m := menus at:activeMenuNumber. |
1222 m isNil ifTrue:[ |
1244 m isNil ifTrue:[ |
1223 (key == #Return |
1245 (key == #Return |
1224 or:[key == #MenuSelect |
1246 or:[key == #MenuSelect |
1225 or:[key == Character space]]) ifTrue:[ |
1247 or:[key == Character space]]) ifTrue:[ |
1226 self performSelectedAction. |
1248 self performSelectedAction. |
1227 ]. |
1249 ]. |
1228 ] ifFalse:[ |
1250 ] ifFalse:[ |
1229 m keyPress:key x:0 y:0. |
1251 m keyPress:key x:0 y:0. |
1230 ]. |
1252 ]. |
1231 |
1253 |
1232 "Modified: 25.2.1997 / 23:38:15 / cg" |
1254 "Modified: 25.2.1997 / 23:38:15 / cg" |
1233 ! |
1255 ! |
1234 |
1256 |
1235 showNoFocus:explicit |
1257 showNoFocus:explicit |
1236 "when stepping focus, hide any active menu" |
1258 "when stepping focus, hide any active menu" |
1237 |
1259 |
1238 explicit ifTrue:[ |
1260 explicit ifTrue:[ |
1239 self hideActiveMenu. |
1261 self hideActiveMenu. |
1240 super showNoFocus:explicit |
1262 super showNoFocus:explicit |
1241 ] |
1263 ] |
1242 |
1264 |
1243 "Modified: 25.2.1997 / 23:31:38 / cg" |
1265 "Modified: 25.2.1997 / 23:31:38 / cg" |
1244 ! ! |
1266 ! ! |
1245 |
1267 |
1405 |
1427 |
1406 "/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]. |
1428 "/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]. |
1407 |
1429 |
1408 showSeparatingLines := DefaultSeparatingLines. "/ false. |
1430 showSeparatingLines := DefaultSeparatingLines. "/ false. |
1409 DefaultViewBackground notNil ifTrue:[ |
1431 DefaultViewBackground notNil ifTrue:[ |
1410 viewBackground := DefaultViewBackground on:device |
1432 viewBackground := DefaultViewBackground on:device |
1411 ]. |
1433 ]. |
1412 |
1434 |
1413 DefaultForegroundColor notNil ifTrue:[ |
1435 DefaultForegroundColor notNil ifTrue:[ |
1414 fgColor := DefaultForegroundColor |
1436 fgColor := DefaultForegroundColor |
1415 ] ifFalse:[ |
1437 ] ifFalse:[ |
1416 fgColor := Black. |
1438 fgColor := Black. |
1417 ]. |
1439 ]. |
1418 DefaultBackgroundColor notNil ifTrue:[ |
1440 DefaultBackgroundColor notNil ifTrue:[ |
1419 bgColor := DefaultBackgroundColor |
1441 bgColor := DefaultBackgroundColor |
1420 ] ifFalse:[ |
1442 ] ifFalse:[ |
1421 bgColor := viewBackground. |
1443 bgColor := viewBackground. |
1422 ]. |
1444 ]. |
1423 onLevel := DefaultHilightLevel. |
1445 onLevel := DefaultHilightLevel. |
1424 offLevel := DefaultLevel. |
1446 offLevel := DefaultLevel. |
1425 |
1447 |
1426 self is3D ifTrue:[ |
1448 self is3D ifTrue:[ |
1427 device hasColors ifTrue:[ |
1449 device hasColors ifTrue:[ |
1428 activeFgColor := Color name:'yellow' |
1450 activeFgColor := Color name:'yellow' |
1429 ] ifFalse:[ |
1451 ] ifFalse:[ |
1430 activeFgColor := White |
1452 activeFgColor := White |
1431 ]. |
1453 ]. |
1432 device hasGrayscales ifTrue:[ |
1454 device hasGrayscales ifTrue:[ |
1433 activeBgColor := bgColor. |
1455 activeBgColor := bgColor. |
1434 ] ifFalse:[ |
1456 ] ifFalse:[ |
1435 activeBgColor := fgColor. |
1457 activeBgColor := fgColor. |
1436 ]. |
1458 ]. |
1437 topMargin := 2. |
1459 topMargin := 2. |
1438 |
1460 |
1439 style := styleSheet name. |
1461 style := styleSheet name. |
1440 ((style == #iris) or:[style == #motif]) ifTrue:[ |
1462 ((style == #iris) or:[style == #motif]) ifTrue:[ |
1441 self level:2. |
1463 self level:2. |
1442 onLevel := 2. |
1464 onLevel := 2. |
1443 offLevel := 0. |
1465 offLevel := 0. |
1444 activeFgColor := fgColor |
1466 activeFgColor := fgColor |
1445 ] |
1467 ] |
1446 ] ifFalse:[ |
1468 ] ifFalse:[ |
1447 activeFgColor := bgColor. |
1469 activeFgColor := bgColor. |
1448 activeBgColor := fgColor. |
1470 activeBgColor := fgColor. |
1449 topMargin := 0 |
1471 topMargin := 0 |
1450 ]. |
1472 ]. |
1451 |
1473 |
1452 edgeStyle := DefaultEdgeStyle. |
1474 edgeStyle := DefaultEdgeStyle. |
1453 keepMenu := DefaultKeepMenu. |
1475 toggleMode := DefaultToggleMode. |
1454 toggleKeep := DefaultToggleKeep. |
|
1455 |
1476 |
1456 DefaultHilightForegroundColor notNil ifTrue:[ |
1477 DefaultHilightForegroundColor notNil ifTrue:[ |
1457 activeFgColor := DefaultHilightForegroundColor |
1478 activeFgColor := DefaultHilightForegroundColor |
1458 ]. |
1479 ]. |
1459 DefaultHilightBackgroundColor notNil ifTrue:[ |
1480 DefaultHilightBackgroundColor notNil ifTrue:[ |
1460 activeBgColor := DefaultHilightBackgroundColor |
1481 activeBgColor := DefaultHilightBackgroundColor |
1461 ]. |
1482 ]. |
1462 DefaultShadowColor notNil ifTrue:[ |
1483 DefaultShadowColor notNil ifTrue:[ |
1463 shadowColor := DefaultShadowColor |
1484 shadowColor := DefaultShadowColor |
1464 ]. |
1485 ]. |
1465 DefaultLightColor notNil ifTrue:[ |
1486 DefaultLightColor notNil ifTrue:[ |
1466 lightColor := DefaultLightColor |
1487 lightColor := DefaultLightColor |
1467 ]. |
1488 ]. |
1468 |
1489 |
1469 raiseTopWhenActivated := styleSheet at:'pullDownMenuRaiseTop' default:true. |
1490 raiseTopWhenActivated := styleSheet at:'pullDownMenuRaiseTop' default:true. |
1470 |
1491 |
1471 "Modified: 17.1.1997 / 23:22:13 / cg" |
1492 "Modified: 17.1.1997 / 23:22:13 / cg" |
1506 If stringOrNumber is not a valid item, return 0." |
1527 If stringOrNumber is not a valid item, return 0." |
1507 |
1528 |
1508 |idx| |
1529 |idx| |
1509 |
1530 |
1510 stringOrNumber isNumber ifTrue:[ |
1531 stringOrNumber isNumber ifTrue:[ |
1511 ^ stringOrNumber |
1532 ^ stringOrNumber |
1512 ]. |
1533 ]. |
1513 selectors notNil ifTrue:[ |
1534 selectors notNil ifTrue:[ |
1514 idx := selectors indexOf:stringOrNumber. |
1535 idx := selectors indexOf:stringOrNumber. |
1515 idx ~~ 0 ifTrue:[^ idx]. |
1536 idx ~~ 0 ifTrue:[^ idx]. |
1516 ]. |
1537 ]. |
1517 stringOrNumber isString ifTrue:[ |
1538 stringOrNumber isString ifTrue:[ |
1518 ^ titles indexOf:stringOrNumber |
1539 ^ titles indexOf:stringOrNumber |
1519 ]. |
1540 ]. |
1520 (stringOrNumber respondsTo:#string) ifTrue:[ |
1541 (stringOrNumber respondsTo:#string) ifTrue:[ |
1521 ^ titles indexOf:stringOrNumber asString |
1542 ^ titles indexOf:stringOrNumber asString |
1522 ]. |
1543 ]. |
1523 ^ 0 |
1544 ^ 0 |
1524 |
1545 |
1525 "Modified: 27.4.1996 / 15:25:28 / cg" |
1546 "Modified: 27.4.1996 / 15:25:28 / cg" |
1526 ! |
1547 ! |
1527 |
1548 |
1528 performEntry:itemIndex |
1549 performEntry:itemIndex |
1529 |block sel| |
1550 |block sel| |
1530 |
1551 |
1531 actions notNil ifTrue:[ |
1552 actions notNil ifTrue:[ |
1532 block := actions at:itemIndex. |
1553 block := actions at:itemIndex. |
1533 block notNil ifTrue:[ |
1554 block notNil ifTrue:[ |
1534 block value. |
1555 block value. |
1535 ^ self |
1556 ^ self |
1536 ]. |
1557 ]. |
1537 ]. |
1558 ]. |
1538 selectors notNil ifTrue:[ |
1559 selectors notNil ifTrue:[ |
1539 sel := selectors at:itemIndex. |
1560 sel := selectors at:itemIndex. |
1540 sel notNil ifTrue:[ |
1561 sel notNil ifTrue:[ |
1541 model notNil ifTrue:[ |
1562 model notNil ifTrue:[ |
1542 model perform:sel |
1563 model perform:sel |
1543 ] ifFalse:[ |
1564 ] ifFalse:[ |
1544 receiver perform:sel |
1565 receiver perform:sel |
1545 ] |
1566 ] |
1546 ]. |
1567 ]. |
1547 ]. |
1568 ]. |
1548 |
1569 |
1549 "Modified: 17.4.1996 / 20:55:11 / cg" |
1570 "Modified: 17.4.1996 / 20:55:11 / cg" |
1550 ! |
1571 ! |
1551 |
1572 |
1552 performSelectedAction |
1573 performSelectedAction |
1553 |block sel| |
1574 |block sel| |
1554 |
1575 |
1555 actions notNil ifTrue:[ |
1576 actions notNil ifTrue:[ |
1556 block := actions at:activeMenuNumber. |
1577 block := actions at:activeMenuNumber. |
1557 block notNil ifTrue:[ |
1578 block notNil ifTrue:[ |
1558 block value. |
1579 block value. |
1559 ^ self |
1580 ^ self |
1560 ]. |
1581 ]. |
1561 ]. |
1582 ]. |
1562 selectors notNil ifTrue:[ |
1583 selectors notNil ifTrue:[ |
1563 sel := selectors at:activeMenuNumber. |
1584 sel := selectors at:activeMenuNumber. |
1564 sel notNil ifTrue:[ |
1585 sel notNil ifTrue:[ |
1565 model notNil ifTrue:[ |
1586 model notNil ifTrue:[ |
1566 model perform:sel |
1587 model perform:sel |
1567 ] ifFalse:[ |
1588 ] ifFalse:[ |
1568 receiver perform:sel |
1589 receiver perform:sel |
1569 ] |
1590 ] |
1570 ]. |
1591 ]. |
1571 ]. |
1592 ]. |
1572 |
1593 |
1573 "Modified: 17.4.1996 / 20:55:11 / cg" |
1594 "Modified: 17.4.1996 / 20:55:11 / cg" |
1574 "Created: 17.4.1996 / 20:55:53 / cg" |
1595 "Created: 17.4.1996 / 20:55:53 / cg" |
1575 ! |
1596 ! |
1576 |
1597 |
1577 setMenuOrigins |
1598 setMenuOrigins |
1578 "adjust origins of menus when font changes" |
1599 "adjust origins of menus when font changes" |
1579 |
1600 |
1580 (font graphicsDevice == device) ifTrue:[ |
1601 (font graphicsDevice == device) ifTrue:[ |
1581 menus notNil ifTrue:[ |
1602 menus notNil ifTrue:[ |
1582 menus keysAndValuesDo:[:index :aMenu | |
1603 menus keysAndValuesDo:[:index :aMenu | |
1583 aMenu notNil ifTrue:[ |
1604 aMenu notNil ifTrue:[ |
1584 aMenu origin:((left + (self titleLenUpTo:index)) |
1605 aMenu origin:((left + (self titleLenUpTo:index)) |
1585 @ |
1606 @ |
1586 (height + aMenu borderWidth)) |
1607 (height + aMenu borderWidth)) |
1587 ]. |
1608 ]. |
1588 ] |
1609 ] |
1589 ] |
1610 ] |
1590 ] |
1611 ] |
1591 |
1612 |
1592 "Modified: 5.7.1996 / 17:55:08 / cg" |
1613 "Modified: 5.7.1996 / 17:55:08 / cg" |
1593 ! |
1614 ! |
1594 |
1615 |