| | 1 | = Menus = |
| | 2 | |
| | 3 | Menus allow the user to view or choose from a list of choices and commands. Each menu has one or more menu items associated with it. A menu item may also be a submenu, sometimes called a hierarchical menu. |
| | 4 | |
| | 5 | {{{menu-item (view view-action-mixin view-text-mixin) [class]}}} |
| | 6 | |
| | 7 | An abstract class representing menu items. A menu item can have a view-action which is invoked when the item is selected, and a view-text which is the name of the menu item. Additional initargs: |
| | 8 | |
| | 9 | '':menu-item-updater'' -- intializes the function call to update the menu item, see set-menu-item-updater. |
| | 10 | |
| | 11 | '':menu-item-key'' -- initializes the menu items command key equivalent, see set-menu-item-key. |
| | 12 | |
| | 13 | '':menu-item-check'' -- initializes the check mark of the menu item, see set-menu-item-check. |
| | 14 | |
| | 15 | '':menu-item-style'' -- initializes the font style in which the item text appears, see set-menu-item-style. |
| | 16 | |
| | 17 | ''TODO: can also set the font family.'' |
| | 18 | |
| | 19 | ''TODO: can also have icons.'' |
| | 20 | |
| | 21 | ''TODO: menu items are not first class objects in Carbon. I guess we'll just return ''nil'' from view-ref. Also will need some hack for getting the item info through command handler so can find the menu-item object.'' |
| | 22 | |
| | 23 | {{{(set-menu-item-updater menu-item updater) [method]}}} |
| | 24 | |
| | 25 | Sets the menu item's updater function to ''updater'', which must be either ''nil'' or a funcallable object (function or symbol). If non-''nil'', it is invoked with one argument, the menu item, to allow it to be adjusted in the current program context (e.g. enabled/disabled) before it is displayed. |
| | 26 | |
| | 27 | {{{(menu-item-updater menu-item updater) [method]}}} |
| | 28 | |
| | 29 | Returns the menu item's updater function. |
| | 30 | |
| | 31 | {{{(set-menu-item-key menu-item key) [method]}}} |
| | 32 | |
| | 33 | Sets the keyboard equivalent for the menu item to key (which may be ''nil'' to remove the keyboard equivalent). |
| | 34 | |
| | 35 | {{{(menu-item-key menu-item) [method]}}} |
| | 36 | |
| | 37 | Returns the keyboard equivalent of the menu item. |
| | 38 | |
| | 39 | {{{(set-menu-item-check menu-item check) [method]}}} |
| | 40 | |
| | 41 | Sets the check mark character that appears next to the menu item text. If check is ''nil'', no check mark appears. If check is ''t'', then a standard check-mark symbol is used. Otherwise it should be a character to be used as the check mark. |
| | 42 | |
| | 43 | {{{(menu-item-check menu-item) [method]}}} |
| | 44 | |
| | 45 | Returns the check mark character that appears next to the menu item text, or ''t'' if the standard check-mark symbol is used, or ''nil'' if no check mark appears. |
| | 46 | |
| | 47 | {{{(set-menu-item-style menu-item style) [method]}}} |
| | 48 | |
| | 49 | Sets the style in which the item text appears, one of :normal or :plain, :bold, :italic, :shadow, :outline, :underline, :condense, and :extend. |
| | 50 | |
| | 51 | {{{(menu-item-style menu-item) [method]}}} |
| | 52 | |
| | 53 | Returns the style in which the item text appears, one of - :normal, :bold, :italic, :shadow, :outline, :underline, :condense, and :extend. |
| | 54 | |
| | 55 | {{{separator-menu-item (menu-item) [class]}}} |
| | 56 | |
| | 57 | A permanently disabled menu item consisting of a long line, used as a separator. |
| | 58 | |
| | 59 | ''TODO: window-menu-item (menu-item) [class] ? '' |
| | 60 | |
| | 61 | ''TODO: font-menu-item (menu-item) [class] ? '' |
| | 62 | |
| | 63 | {{{menu (menu-item view-nib-mixin) [class]}}} |
| | 64 | |
| | 65 | The class of menus. Additional initargs: |
| | 66 | |
| | 67 | '':menu-items'' -- initializes the menu's menu items, see set-menu-items. |
| | 68 | |
| | 69 | {{{(set-menu-items menu items) [method]}}} |
| | 70 | |
| | 71 | Sets the menu items associated with menu to ''items'', which must be a sequence of menu-item's. |
| | 72 | |
| | 73 | {{{(menu-items menu) [method]}}} |
| | 74 | |
| | 75 | Returns a freshly consed list of menu-item's associated with menu. |
| | 76 | |
| | 77 | {{{(set-menubar menu) [method]}}} |
| | 78 | |
| | 79 | Sets the root menu, also known as the menubar, to menu. |
| | 80 | |
| | 81 | {{{(menubar) [method]}}} |
| | 82 | |
| | 83 | Returns the menu object that is the current menubar. |
| | 84 | |