[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.