[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

layoutmenuitems() performs the same function as layoutmenus(), but only
affects the menu items and sub-items of a single menu instead of the whole
menu strip.  Ordinarily, there is no need to call this function after
having called LayoutMenus().  This function is useful for adding menu
items to an extensible menu, such as the Workbench "Tools" menu.

For example, a single menuitem can be created by calling createmenus()
with a two-entry newmenu array whose first entry is of type nm_item and
whose second is of type nm_end.  the menu strip may then be removed and
this new item linked to the end of an extensible menu by placing its
address in the nextitem field of the last menuitem in the menu.
layoutmenuitems() can then be used to to recalculate the layout of just
the items in the extensible menu and, finally, the menu strip can be
reattached to the window.

    BOOL LayoutMenuItemsA( struct MenuItem *firstitem, APTR vi,
                           struct TagItem *taglist );
    BOOL LayoutMenuItems( struct MenuItem *firstitem, APTR vi,
                          Tag tag1, ... );

Set firstitem to a pointer to the first menuitem in the linked list of
MenuItems that make up the menu.  (see the "intuition menus" chapter for
more about these structures.)  Set vi to the address of a visualinfo
handle obtained from getvisualinfo(). the tag arguments, tag1 or taglist,
may be set as follows:

GTMN_TextAttr
    A pointer to an openable font (textattr structure) to be used for the
    menu item and sub-item text.  The default is to use the screen's font.

GTMN_Menu
    Use this tag to provide a pointer to the menu structure whose
    firstitem is passed as the first parameter to this function.  this
    tag should always be used.

layoutmenuitems() returns true if it succeeds and false otherwise.