314 ] |
252 ] |
315 |
253 |
316 "Modified: / 4.2.2000 / 12:39:30 / cg" |
254 "Modified: / 4.2.2000 / 12:39:30 / cg" |
317 ! |
255 ! |
318 |
256 |
|
257 submenu |
|
258 adornment notNil ifTrue:[ |
|
259 ^ adornment submenu |
|
260 ]. |
|
261 ^ nil |
|
262 |
|
263 "Created: 25.2.1997 / 20:57:24 / cg" |
|
264 ! |
|
265 |
|
266 submenu:aMenu |
|
267 (aMenu notNil or:[adornment notNil]) ifTrue:[ |
|
268 self adornment submenu:aMenu |
|
269 ] |
|
270 |
|
271 "Created: / 25.2.1997 / 20:56:20 / cg" |
|
272 "Modified: / 4.2.2000 / 12:40:02 / cg" |
|
273 ! |
|
274 |
|
275 submenuChannel |
|
276 adornment notNil ifTrue:[ |
|
277 ^ adornment submenuChannel |
|
278 ]. |
|
279 ^ nil |
|
280 ! |
|
281 |
|
282 submenuChannel:something |
|
283 (something notNil or:[adornment notNil]) ifTrue:[ |
|
284 self adornment submenuChannel:something |
|
285 ] |
|
286 |
|
287 "Modified: / 4.2.2000 / 12:40:19 / cg" |
|
288 ! |
|
289 |
|
290 value |
|
291 ^ value |
|
292 |
|
293 "Created: 25.2.1997 / 19:50:14 / cg" |
|
294 ! |
|
295 |
|
296 value:something |
|
297 value := something |
|
298 |
|
299 "Created: 25.2.1997 / 19:11:13 / cg" |
|
300 ! ! |
|
301 |
|
302 !MenuItem methodsFor:'accessing-behavior'! |
|
303 |
|
304 beOff |
|
305 "set indication off |
|
306 " |
|
307 self indication:false |
|
308 ! |
|
309 |
|
310 beOn |
|
311 "set indication on |
|
312 " |
|
313 self indication:true |
|
314 ! |
|
315 |
|
316 choice |
|
317 "return the menu items choice indicator (RadioButton) |
|
318 " |
|
319 adornment notNil ifTrue:[ |
|
320 ^ adornment choice |
|
321 ]. |
|
322 ^ nil |
|
323 |
|
324 "Created: / 14.8.1998 / 14:34:55 / cg" |
|
325 "Modified: / 14.8.1998 / 15:11:57 / cg" |
|
326 ! |
|
327 |
|
328 choice:aChoice |
|
329 "set the menu items choice indicator (RadioButton) |
|
330 " |
|
331 (aChoice notNil or:[adornment notNil]) ifTrue:[ |
|
332 self adornment choice:aChoice. |
|
333 ]. |
|
334 |
|
335 "Created: / 14.8.1998 / 15:11:17 / cg" |
|
336 ! |
|
337 |
|
338 choiceValue |
|
339 "return the menu items choiceValue (RadioButton) |
|
340 " |
|
341 adornment notNil ifTrue:[ |
|
342 ^ adornment choiceValue |
|
343 ]. |
|
344 ^ nil |
|
345 |
|
346 "Modified: / 14.8.1998 / 15:11:57 / cg" |
|
347 "Created: / 14.8.1998 / 15:38:05 / cg" |
|
348 ! |
|
349 |
|
350 choiceValue:something |
|
351 "set the menu items choiceValue (RadioButton) |
|
352 " |
|
353 (something notNil or:[adornment notNil]) ifTrue:[ |
|
354 self adornment choiceValue:something. |
|
355 ]. |
|
356 |
|
357 "Created: / 14.8.1998 / 15:39:12 / cg" |
|
358 ! |
|
359 |
|
360 delayMenu |
|
361 "return true, the menu is shown delayed, if the button is still pressed after a while. |
|
362 Only useful with buttons in non-popup-menus |
|
363 " |
|
364 ^ delayMenu ? false |
|
365 ! |
|
366 |
|
367 delayMenu:aBoolean |
|
368 "if true, the menu is shown delayed, if the button is still pressed after a while. |
|
369 Only useful with buttons in non-popup-menus |
|
370 " |
|
371 delayMenu := aBoolean |
|
372 ! |
|
373 |
|
374 disable |
|
375 enabled := false |
|
376 |
|
377 "Created: 25.2.1997 / 19:39:09 / cg" |
|
378 ! |
|
379 |
|
380 enable |
|
381 enabled := true |
|
382 |
|
383 "Created: 25.2.1997 / 19:39:00 / cg" |
|
384 ! |
|
385 |
|
386 enabled |
|
387 "returns a boolean, valueHolder or block |
|
388 " |
|
389 ^ enabled |
|
390 ! |
|
391 |
|
392 enabled:something |
|
393 "a boolean, valueHolder or block |
|
394 " |
|
395 enabled := something |
|
396 ! |
|
397 |
|
398 hideMenuOnActivated |
|
399 "hide the menu when the item was activated; the default is true |
|
400 " |
|
401 ^ hideMenuOnActivated ? true |
|
402 |
|
403 ! |
|
404 |
|
405 hideMenuOnActivated:aBool |
|
406 "hide the menu when the item was activated; the default is true |
|
407 " |
|
408 hideMenuOnActivated := aBool ? true |
|
409 |
|
410 ! |
|
411 |
|
412 indication |
|
413 "return the menu items on/off indicator (CheckToggle) |
|
414 " |
|
415 adornment notNil ifTrue:[ |
|
416 ^ adornment indication |
|
417 ]. |
|
418 ^ nil |
|
419 |
|
420 "Modified: / 14.8.1998 / 15:11:37 / cg" |
|
421 ! |
|
422 |
|
423 indication:anIndication |
|
424 "set the menu items an on/off indicator (CheckToggle) |
|
425 " |
|
426 (anIndication notNil or:[adornment notNil]) ifTrue:[ |
|
427 self adornment indication:anIndication. |
|
428 ]. |
|
429 |
|
430 "Modified: / 14.8.1998 / 15:11:25 / cg" |
|
431 ! |
|
432 |
319 showBusyCursorWhilePerforming |
433 showBusyCursorWhilePerforming |
320 "get the flag which controls if a busy cursor is to be shown |
434 "get the flag which controls if a busy cursor is to be shown |
321 while performing the menu action. Defaults to false." |
435 while performing the menu action. Defaults to false." |
322 |
436 |
323 adornment notNil ifTrue:[ |
437 adornment notNil ifTrue:[ |
330 "set/clear the flag which controls if a busy cursor is to be shown |
444 "set/clear the flag which controls if a busy cursor is to be shown |
331 while performing the menu action. Defaults to false." |
445 while performing the menu action. Defaults to false." |
332 |
446 |
333 ((aBoolean == true) or:[adornment notNil]) ifTrue:[ |
447 ((aBoolean == true) or:[adornment notNil]) ifTrue:[ |
334 self adornment showBusyCursorWhilePerforming:aBoolean |
448 self adornment showBusyCursorWhilePerforming:aBoolean |
|
449 ] |
|
450 ! |
|
451 |
|
452 translateLabel |
|
453 "returns whether label is translated |
|
454 " |
|
455 ^translateLabel ? false |
|
456 |
|
457 |
|
458 ! |
|
459 |
|
460 translateLabel:anBoolean |
|
461 "sets whether label is translated |
|
462 " |
|
463 translateLabel := anBoolean |
|
464 |
|
465 |
|
466 ! |
|
467 |
|
468 triggerOnDown |
|
469 "trigger the action if pressed |
|
470 " |
|
471 ^ triggerOnDown ? false |
|
472 |
|
473 ! |
|
474 |
|
475 triggerOnDown:aBool |
|
476 "trigger the action if pressed |
|
477 " |
|
478 triggerOnDown := aBool. |
|
479 ! ! |
|
480 |
|
481 !MenuItem methodsFor:'accessing-look'! |
|
482 |
|
483 font |
|
484 "get the specific font for an item or nil |
|
485 " |
|
486 adornment notNil ifTrue:[ |
|
487 ^ adornment font |
|
488 ]. |
|
489 ^ nil |
|
490 ! |
|
491 |
|
492 font:aFont |
|
493 "set the index of the access character in the label text or string, or nil if none |
|
494 " |
|
495 |
|
496 (aFont isNil and:[adornment isNil]) ifFalse:[ |
|
497 self adornment font:aFont |
|
498 ] |
|
499 ! |
|
500 |
|
501 horizontalLayout |
|
502 "on default submenus has a vertical layout; |
|
503 true, the submenu has a horizontal layout. |
|
504 " |
|
505 adornment notNil ifTrue:[ |
|
506 ^ adornment horizontalLayout |
|
507 ]. |
|
508 ^ nil |
|
509 ! |
|
510 |
|
511 horizontalLayout:aBoolean |
|
512 "on default submenus has a vertical layout; |
|
513 true, the submenu has a horizontal layout. |
|
514 " |
|
515 ((aBoolean == true) or:[adornment notNil]) ifTrue:[ |
|
516 self adornment horizontalLayout:aBoolean |
|
517 ]. |
|
518 ! |
|
519 |
|
520 isButton |
|
521 "returns whether item looks like a Button |
|
522 " |
|
523 ^isButton ? false |
|
524 |
|
525 |
|
526 ! |
|
527 |
|
528 isButton:anBoolean |
|
529 "sets whether item looks like a Button |
|
530 " |
|
531 isButton := anBoolean |
|
532 |
|
533 |
|
534 ! |
|
535 |
|
536 label |
|
537 ^ self filteredLabel "/ label |
|
538 |
|
539 "Created: / 25.2.1997 / 19:48:16 / cg" |
|
540 "Modified: / 19.6.1998 / 00:02:55 / cg" |
|
541 ! |
|
542 |
|
543 label:aString |
|
544 label := aString |
|
545 |
|
546 "Created: 25.2.1997 / 19:55:16 / cg" |
|
547 ! |
|
548 |
|
549 labelImage |
|
550 "gets the labelImage |
|
551 " |
|
552 adornment notNil ifTrue:[ |
|
553 ^ adornment labelImage value |
|
554 ]. |
|
555 ^ nil |
|
556 ! |
|
557 |
|
558 labelImage:aResourceRetriever |
|
559 "set the labelImage |
|
560 " |
|
561 aResourceRetriever notNil ifTrue:[ |
|
562 self adornment labelImage:aResourceRetriever |
335 ] |
563 ] |
336 ! |
564 ! |
337 |
565 |
338 startGroup |
566 startGroup |
339 "start group #left #right #center ... or nil |
567 "start group #left #right #center ... or nil |
350 startGroup := aSymbol |
578 startGroup := aSymbol |
351 ] ifFalse:[ |
579 ] ifFalse:[ |
352 self warn:('unsupported group: ', aSymbol printString ). |
580 self warn:('unsupported group: ', aSymbol printString ). |
353 startGroup := #left |
581 startGroup := #left |
354 ] |
582 ] |
355 ! |
|
356 |
|
357 submenu |
|
358 adornment notNil ifTrue:[ |
|
359 ^ adornment submenu |
|
360 ]. |
|
361 ^ nil |
|
362 |
|
363 "Created: 25.2.1997 / 20:57:24 / cg" |
|
364 ! |
|
365 |
|
366 submenu:aMenu |
|
367 (aMenu notNil or:[adornment notNil]) ifTrue:[ |
|
368 self adornment submenu:aMenu |
|
369 ] |
|
370 |
|
371 "Created: / 25.2.1997 / 20:56:20 / cg" |
|
372 "Modified: / 4.2.2000 / 12:40:02 / cg" |
|
373 ! |
|
374 |
|
375 submenuChannel |
|
376 adornment notNil ifTrue:[ |
|
377 ^ adornment submenuChannel |
|
378 ]. |
|
379 ^ nil |
|
380 ! |
|
381 |
|
382 submenuChannel:something |
|
383 (something notNil or:[adornment notNil]) ifTrue:[ |
|
384 self adornment submenuChannel:something |
|
385 ] |
|
386 |
|
387 "Modified: / 4.2.2000 / 12:40:19 / cg" |
|
388 ! |
|
389 |
|
390 triggerOnDown |
|
391 "trigger the action if pressed |
|
392 " |
|
393 ^ triggerOnDown ? false |
|
394 |
|
395 ! |
|
396 |
|
397 triggerOnDown:aBool |
|
398 "trigger the action if pressed |
|
399 " |
|
400 triggerOnDown := aBool. |
|
401 ! |
|
402 |
|
403 value |
|
404 ^ value |
|
405 |
|
406 "Created: 25.2.1997 / 19:50:14 / cg" |
|
407 ! |
|
408 |
|
409 value:something |
|
410 value := something |
|
411 |
|
412 "Created: 25.2.1997 / 19:11:13 / cg" |
|
413 ! ! |
|
414 |
|
415 !MenuItem methodsFor:'accessing-behavior'! |
|
416 |
|
417 beOff |
|
418 "set indication off |
|
419 " |
|
420 self indication:false |
|
421 ! |
|
422 |
|
423 beOn |
|
424 "set indication on |
|
425 " |
|
426 self indication:true |
|
427 ! |
|
428 |
|
429 choice |
|
430 "return the menu items choice indicator (RadioButton) |
|
431 " |
|
432 adornment notNil ifTrue:[ |
|
433 ^ adornment choice |
|
434 ]. |
|
435 ^ nil |
|
436 |
|
437 "Created: / 14.8.1998 / 14:34:55 / cg" |
|
438 "Modified: / 14.8.1998 / 15:11:57 / cg" |
|
439 ! |
|
440 |
|
441 choice:aChoice |
|
442 "set the menu items choice indicator (RadioButton) |
|
443 " |
|
444 (aChoice notNil or:[adornment notNil]) ifTrue:[ |
|
445 self adornment choice:aChoice. |
|
446 ]. |
|
447 |
|
448 "Created: / 14.8.1998 / 15:11:17 / cg" |
|
449 ! |
|
450 |
|
451 choiceValue |
|
452 "return the menu items choiceValue (RadioButton) |
|
453 " |
|
454 adornment notNil ifTrue:[ |
|
455 ^ adornment choiceValue |
|
456 ]. |
|
457 ^ nil |
|
458 |
|
459 "Modified: / 14.8.1998 / 15:11:57 / cg" |
|
460 "Created: / 14.8.1998 / 15:38:05 / cg" |
|
461 ! |
|
462 |
|
463 choiceValue:something |
|
464 "set the menu items choiceValue (RadioButton) |
|
465 " |
|
466 (something notNil or:[adornment notNil]) ifTrue:[ |
|
467 self adornment choiceValue:something. |
|
468 ]. |
|
469 |
|
470 "Created: / 14.8.1998 / 15:39:12 / cg" |
|
471 ! |
|
472 |
|
473 disable |
|
474 enabled := false |
|
475 |
|
476 "Created: 25.2.1997 / 19:39:09 / cg" |
|
477 ! |
|
478 |
|
479 enable |
|
480 enabled := true |
|
481 |
|
482 "Created: 25.2.1997 / 19:39:00 / cg" |
|
483 ! |
|
484 |
|
485 enabled |
|
486 "returns a boolean, valueHolder or block |
|
487 " |
|
488 ^ enabled |
|
489 ! |
|
490 |
|
491 enabled:something |
|
492 "a boolean, valueHolder or block |
|
493 " |
|
494 enabled := something |
|
495 ! |
|
496 |
|
497 horizontalLayout |
|
498 "on default submenus has a vertical layout; |
|
499 true, the submenu has a horizontal layout. |
|
500 " |
|
501 adornment notNil ifTrue:[ |
|
502 ^ adornment horizontalLayout |
|
503 ]. |
|
504 ^ nil |
|
505 ! |
|
506 |
|
507 horizontalLayout:aBoolean |
|
508 "on default submenus has a vertical layout; |
|
509 true, the submenu has a horizontal layout. |
|
510 " |
|
511 ((aBoolean == true) or:[adornment notNil]) ifTrue:[ |
|
512 self adornment horizontalLayout:aBoolean |
|
513 ]. |
|
514 ! |
|
515 |
|
516 indication |
|
517 "return the menu items on/off indicator (CheckToggle) |
|
518 " |
|
519 adornment notNil ifTrue:[ |
|
520 ^ adornment indication |
|
521 ]. |
|
522 ^ nil |
|
523 |
|
524 "Modified: / 14.8.1998 / 15:11:37 / cg" |
|
525 ! |
|
526 |
|
527 indication:anIndication |
|
528 "set the menu items an on/off indicator (CheckToggle) |
|
529 " |
|
530 (anIndication notNil or:[adornment notNil]) ifTrue:[ |
|
531 self adornment indication:anIndication. |
|
532 ]. |
|
533 |
|
534 "Modified: / 14.8.1998 / 15:11:25 / cg" |
|
535 ! |
|
536 |
|
537 isButton |
|
538 "returns whether item looks like a Button |
|
539 " |
|
540 ^isButton ? false |
|
541 |
|
542 |
|
543 ! |
|
544 |
|
545 isButton:anBoolean |
|
546 "sets whether item looks like a Button |
|
547 " |
|
548 isButton := anBoolean |
|
549 |
|
550 |
|
551 ! |
|
552 |
|
553 translateLabel |
|
554 "returns whether label is translated |
|
555 " |
|
556 ^translateLabel ? false |
|
557 |
|
558 |
|
559 ! |
|
560 |
|
561 translateLabel:anBoolean |
|
562 "sets whether label is translated |
|
563 " |
|
564 translateLabel := anBoolean |
|
565 |
|
566 |
|
567 ! ! |
583 ! ! |
568 |
584 |
569 !MenuItem methodsFor:'accessing-resource'! |
585 !MenuItem methodsFor:'accessing-resource'! |
570 |
586 |
571 findGuiResourcesIn:aResourceContainerOrApplication |
587 findGuiResourcesIn:aResourceContainerOrApplication |