12f746eafSJohn Scipione/* 22f746eafSJohn Scipione * Copyright 2013 Haiku Inc. All rights reserved. 32f746eafSJohn Scipione * Distributed under the terms of the MIT License. 42f746eafSJohn Scipione * 52f746eafSJohn Scipione * Authors: 62f746eafSJohn Scipione * John Scipione, jscipione@gmail.com 72f746eafSJohn Scipione * 82f746eafSJohn Scipione * Corresponds to: 90d635255SJohn Scipione * headers/os/interface/Menu.h hrev46321 100d635255SJohn Scipione * src/kits/interface/Menu.cpp hrev46321 112f746eafSJohn Scipione */ 122f746eafSJohn Scipione 132f746eafSJohn Scipione 142f746eafSJohn Scipione/*! 152f746eafSJohn Scipione \file Menu.h 162f746eafSJohn Scipione \ingroup interface 172f746eafSJohn Scipione \ingroup libbe 18*d7d2ff5bSJohn Scipione \brief BMenu class definition and support structures. 192f746eafSJohn Scipione*/ 202f746eafSJohn Scipione 212f746eafSJohn Scipione 222f746eafSJohn Scipione/*! 232f746eafSJohn Scipione \enum menu_layout 242f746eafSJohn Scipione \ingroup interface 252f746eafSJohn Scipione 262f746eafSJohn Scipione Constants to define the layout of the menu items in a menu. 272f746eafSJohn Scipione*/ 282f746eafSJohn Scipione 292f746eafSJohn Scipione 302f746eafSJohn Scipione/*! 312f746eafSJohn Scipione \var menu_layout B_ITEMS_IN_ROW 322f746eafSJohn Scipione 332f746eafSJohn Scipione Items are arranged in a row, one next to the other. 342f746eafSJohn Scipione*/ 352f746eafSJohn Scipione 362f746eafSJohn Scipione 372f746eafSJohn Scipione/*! 382f746eafSJohn Scipione \var menu_layout B_ITEMS_IN_COLUMN 392f746eafSJohn Scipione 402f746eafSJohn Scipione Items are arranged in a column, one on top of the other. 412f746eafSJohn Scipione*/ 422f746eafSJohn Scipione 432f746eafSJohn Scipione 442f746eafSJohn Scipione/*! 452f746eafSJohn Scipione \var menu_layout B_ITEMS_IN_MATRIX 462f746eafSJohn Scipione 472f746eafSJohn Scipione Items are arranged in a matrix, a free-form arrangement that you create. 482f746eafSJohn Scipione*/ 492f746eafSJohn Scipione 502f746eafSJohn Scipione 512f746eafSJohn Scipione/*! 522f746eafSJohn Scipione \struct menu_info 532f746eafSJohn Scipione \ingroup interface 542f746eafSJohn Scipione \ingroup libbe 552f746eafSJohn Scipione \brief Information about a menu such as font size and family, background 562f746eafSJohn Scipione color, and flags. 572f746eafSJohn Scipione*/ 582f746eafSJohn Scipione 592f746eafSJohn Scipione 602f746eafSJohn Scipione/*! 612f746eafSJohn Scipione \var menu_info::font_size 622f746eafSJohn Scipione 632f746eafSJohn Scipione The font size to draw menu items with. 642f746eafSJohn Scipione*/ 652f746eafSJohn Scipione 662f746eafSJohn Scipione 672f746eafSJohn Scipione/*! 682f746eafSJohn Scipione \var menu_info::f_family 692f746eafSJohn Scipione 702f746eafSJohn Scipione The font family used to draw menu items. 712f746eafSJohn Scipione*/ 722f746eafSJohn Scipione 732f746eafSJohn Scipione 742f746eafSJohn Scipione/*! 752f746eafSJohn Scipione \var menu_info::f_style 762f746eafSJohn Scipione 772f746eafSJohn Scipione The font style used to draw menu items. 782f746eafSJohn Scipione*/ 792f746eafSJohn Scipione 802f746eafSJohn Scipione 812f746eafSJohn Scipione/*! 822f746eafSJohn Scipione \var menu_info::background_color 832f746eafSJohn Scipione 842f746eafSJohn Scipione The menu's background color. 852f746eafSJohn Scipione*/ 862f746eafSJohn Scipione 872f746eafSJohn Scipione 882f746eafSJohn Scipione/*! 892f746eafSJohn Scipione \var menu_info::separator 902f746eafSJohn Scipione 912f746eafSJohn Scipione The style of horizontal line to use to separates groups of items in a menu. 922f746eafSJohn Scipione*/ 932f746eafSJohn Scipione 942f746eafSJohn Scipione 952f746eafSJohn Scipione/*! 962f746eafSJohn Scipione \var menu_info::click_to_open 972f746eafSJohn Scipione 982f746eafSJohn Scipione Whether or not the menu opens on click. The default value is \c true. 992f746eafSJohn Scipione*/ 1002f746eafSJohn Scipione 1012f746eafSJohn Scipione 1022f746eafSJohn Scipione/*! 1032f746eafSJohn Scipione \var menu_info::triggers_always_shown 1042f746eafSJohn Scipione 1052f746eafSJohn Scipione Whether or not trigger underlines should always be shown. The default value 1062f746eafSJohn Scipione is \c false. 1072f746eafSJohn Scipione*/ 1082f746eafSJohn Scipione 1092f746eafSJohn Scipione 1102f746eafSJohn Scipione/*! 1112f746eafSJohn Scipione \fn status_t get_menu_info(menu_info* info) 1122f746eafSJohn Scipione \brief Fill out the menu_info struct into \a info. 1132f746eafSJohn Scipione*/ 1142f746eafSJohn Scipione 1152f746eafSJohn Scipione 1162f746eafSJohn Scipione/*! 1172f746eafSJohn Scipione \fn status_t set_menu_info(menu_info* info) 1182f746eafSJohn Scipione \brief Set the menu's menu_info struct to \a info adjusting how the menu 1192f746eafSJohn Scipione will look and work. 1202f746eafSJohn Scipione*/ 1212f746eafSJohn Scipione 1222f746eafSJohn Scipione 1232f746eafSJohn Scipione/*! 1242f746eafSJohn Scipione \typedef bool (*menu_tracking_hook)(BMenu* menu, void* state) 1252f746eafSJohn Scipione \brief Defines the function passed into BMenu::SetTrackingHook(). 1262f746eafSJohn Scipione*/ 1272f746eafSJohn Scipione 1282f746eafSJohn Scipione 1292f746eafSJohn Scipione/*! 1302f746eafSJohn Scipione \class BMenu 1312f746eafSJohn Scipione \ingroup interface 1322f746eafSJohn Scipione \ingroup libbe 1332f746eafSJohn Scipione \brief Displays a list of menu items including additional menus 1342f746eafSJohn Scipione arranged hierarchically. 1352f746eafSJohn Scipione 1362f746eafSJohn Scipione A newly created BMenu object doesn't contain any menu items, you need to call 1370d635255SJohn Scipione AddItem() or AddList() to add some. 1382f746eafSJohn Scipione 1392f746eafSJohn Scipione In addition to BMenuItem objects you can also add additional BMenu objects in 1402f746eafSJohn Scipione order to create a menu hierarchy. Unlike menus in other operating systems you 1412f746eafSJohn Scipione can always select both the submenu and menu items, although selecting the 1422f746eafSJohn Scipione submenu might not actually produce any action other than to close the menu. 1432f746eafSJohn Scipione The name of a submenu is used to draw its label. 1442f746eafSJohn Scipione 1452f746eafSJohn Scipione \image html BMenu_example.png 1462f746eafSJohn Scipione 1472f746eafSJohn Scipione BMenu is the basis of several other Interface Kit classes including BMenuBar 1482f746eafSJohn Scipione and BPopUpMenu. See BMenu::SetRadioMode() and BMenu::SetLabelFromMarked() 1492f746eafSJohn Scipione for additional details on how BMenu and BPopUpMenu are related. 1502f746eafSJohn Scipione 1512f746eafSJohn Scipione Menus arrange their items in one of three possible layouts: 1522f746eafSJohn Scipione <table> 1532f746eafSJohn Scipione <tr> 1542f746eafSJohn Scipione <td>\c B_ITEMS_IN_COLUMN</td> 1552f746eafSJohn Scipione <td> 1562f746eafSJohn Scipione The menu items are stacked vertically in a column, one on top 1572f746eafSJohn Scipione of another, as in a typical pop-up menu. 1582f746eafSJohn Scipione </td> 1592f746eafSJohn Scipione </tr> 1602f746eafSJohn Scipione <tr> 1612f746eafSJohn Scipione <td>\c B_ITEMS_IN_ROW</td> 1622f746eafSJohn Scipione <td> 1632f746eafSJohn Scipione The menu items are laid out horizontally in a row, from end to 1642f746eafSJohn Scipione end, as in a typical menu bar. 1652f746eafSJohn Scipione </td> 1662f746eafSJohn Scipione </tr> 1672f746eafSJohn Scipione <tr> 1682f746eafSJohn Scipione <td>\c B_ITEMS_IN_MATRIX</td> 1692f746eafSJohn Scipione <td> 1702f746eafSJohn Scipione The menu items are arranged in a free-form arrangement that you 1712f746eafSJohn Scipione create, such as a matrix. 1722f746eafSJohn Scipione </td> 1732f746eafSJohn Scipione </tr> 1742f746eafSJohn Scipione </table> 1752f746eafSJohn Scipione 1762f746eafSJohn Scipione Either \c B_ITEMS_IN_COLUMN or \c B_ITEMS_IN_ROW can be passed into the 1772f746eafSJohn Scipione default constructor, but, you should use the constructor that allows you to 1782f746eafSJohn Scipione set the height and width of the menu in order to utilize the 1792f746eafSJohn Scipione \c B_ITEMS_IN_MATRIX layout. 1802f746eafSJohn Scipione 1812f746eafSJohn Scipione Several methods will only work in some layouts as noted in the method 1822f746eafSJohn Scipione description below. 1832f746eafSJohn Scipione*/ 1842f746eafSJohn Scipione 1852f746eafSJohn Scipione 1862f746eafSJohn Scipione/*! 1872f746eafSJohn Scipione \fn BMenu::BMenu(const char* name, menu_layout layout) 1882f746eafSJohn Scipione \brief Creates a new menu object with the specified \a name and \a layout. 1892f746eafSJohn Scipione 1902f746eafSJohn Scipione Don't pass \c B_ITEMS_IN_MATRIX into \a layout with this method, use 1912f746eafSJohn Scipione BMenu::BMenu(const char* name, float width, float height) instead. 1922f746eafSJohn Scipione 1932f746eafSJohn Scipione \param name The menu's \a name, serves as a label for submenus. 1942f746eafSJohn Scipione \param layout The menu layout, possibilities include: 1952f746eafSJohn Scipione - \c B_ITEMS_IN_ROW items are displayed in a single row, 1962f746eafSJohn Scipione - \c B_ITEMS_IN_COLUMN items are displayed in a single column. 1972f746eafSJohn Scipione*/ 1982f746eafSJohn Scipione 1992f746eafSJohn Scipione 2002f746eafSJohn Scipione/*! 2012f746eafSJohn Scipione \fn BMenu::BMenu(const char* name, float width, float height) 2022f746eafSJohn Scipione \brief Creates a new menu object with a \c B_ITEMS_IN_MATRIX layout and the 2032f746eafSJohn Scipione specified \a name, \a width, and \a height. 2042f746eafSJohn Scipione 2052f746eafSJohn Scipione \param name The menu's \a name, serves as a label for submenus. 2062f746eafSJohn Scipione \param width The menu \a width. 2072f746eafSJohn Scipione \param height The menu \a height. 2082f746eafSJohn Scipione*/ 2092f746eafSJohn Scipione 2102f746eafSJohn Scipione 2112f746eafSJohn Scipione/*! 2122f746eafSJohn Scipione \fn BMenu::BMenu(BMessage* archive) 2132f746eafSJohn Scipione \brief Archive constructor. 2142f746eafSJohn Scipione 2152f746eafSJohn Scipione \param archive The message data to construct the menu from. 2162f746eafSJohn Scipione*/ 2172f746eafSJohn Scipione 2182f746eafSJohn Scipione 2192f746eafSJohn Scipione/*! 2202f746eafSJohn Scipione \fn BMenu::~BMenu() 2212f746eafSJohn Scipione \brief Destructor. 2222f746eafSJohn Scipione 2230d635255SJohn Scipione Also frees the memory used by any attached menu items and submenus. 2242f746eafSJohn Scipione*/ 2252f746eafSJohn Scipione 2262f746eafSJohn Scipione 2272f746eafSJohn Scipione/*! 2282f746eafSJohn Scipione \fn BArchivable* BMenu::Instantiate(BMessage* archive) 2292f746eafSJohn Scipione \brief Creates a new BMenu object from an \a archive message. 2302f746eafSJohn Scipione 2312f746eafSJohn Scipione \returns A newly created BMenu object or \c NULL if the message doesn't 2322f746eafSJohn Scipione contain an archived BMenu. 2332f746eafSJohn Scipione*/ 2342f746eafSJohn Scipione 2352f746eafSJohn Scipione 2362f746eafSJohn Scipione/*! 2370d635255SJohn Scipione \fn status_t BMenu::Archive(BMessage* data, bool deep) const 2380d635255SJohn Scipione \brief Archives the the BMenu object into the \a data message. 2390d635255SJohn Scipione 2400d635255SJohn Scipione \param data A pointer to the BMessage to archive the object into. 2410d635255SJohn Scipione \param deep Whether or not to archive attached menu items as well. 2420d635255SJohn Scipione 2430d635255SJohn Scipione \return A status code, \c B_OK if everything went well or an error code 2440d635255SJohn Scipione otherwise. 2450d635255SJohn Scipione \retval B_OK The object was archived successfully. 2460d635255SJohn Scipione \retval B_NO_MEMORY Ran out of memory while archiving the object. 2470d635255SJohn Scipione*/ 2480d635255SJohn Scipione 2490d635255SJohn Scipione 2500d635255SJohn Scipione/*! 2512f746eafSJohn Scipione \fn void BMenu::AttachedToWindow() 2522f746eafSJohn Scipione \brief Lays out the menu items and resizes the menu to fit. 2532f746eafSJohn Scipione*/ 2542f746eafSJohn Scipione 2552f746eafSJohn Scipione 2562f746eafSJohn Scipione/*! 2572f746eafSJohn Scipione \fn void BMenu::Draw(BRect updateRect) 2582f746eafSJohn Scipione \brief Draws the menu. 2592f746eafSJohn Scipione 2602f746eafSJohn Scipione \param updateRect The area to draw in. 2612f746eafSJohn Scipione*/ 2622f746eafSJohn Scipione 2632f746eafSJohn Scipione 2642f746eafSJohn Scipione/*! 2652f746eafSJohn Scipione \fn void BMenu::MessageReceived(BMessage* message) 2662f746eafSJohn Scipione \brief Handles a \a message received by the associated looper. 2672f746eafSJohn Scipione 2682f746eafSJohn Scipione Responds to mouse wheel events scrolling the menu if it is too 2692f746eafSJohn Scipione long to fit in the window. Hold \c B_SHIFT_KEY to cause the menu 2702f746eafSJohn Scipione to scroll faster. 2712f746eafSJohn Scipione 2722f746eafSJohn Scipione \param message The \a message received by the associated looper. 2732f746eafSJohn Scipione*/ 2742f746eafSJohn Scipione 2752f746eafSJohn Scipione 2762f746eafSJohn Scipione/*! 2772f746eafSJohn Scipione \fn void BMenu::KeyDown(const char* bytes, int32 numBytes) 2782f746eafSJohn Scipione \brief Hook method that is called when a keyboard key is pressed. 2792f746eafSJohn Scipione 2802f746eafSJohn Scipione Handles keyboard navigation and triggers. 2812f746eafSJohn Scipione 2822f746eafSJohn Scipione \param bytes The bytes of the key combination pressed. 2832f746eafSJohn Scipione \param numBytes The number of bytes in \a bytes. 2842f746eafSJohn Scipione*/ 2852f746eafSJohn Scipione 2862f746eafSJohn Scipione 2872f746eafSJohn Scipione/*! 2882f746eafSJohn Scipione \fn bool BMenu::AddItem(BMenuItem* item) 2892f746eafSJohn Scipione \brief Adds a menu \a item to the end of the list. 2902f746eafSJohn Scipione 2912f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 2922f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 2932f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 2942f746eafSJohn Scipione 2952f746eafSJohn Scipione \param item The menu \a item to add. 2962f746eafSJohn Scipione 2972f746eafSJohn Scipione \return Whether or not the \a item was added to the menu. 2982f746eafSJohn Scipione*/ 2992f746eafSJohn Scipione 3002f746eafSJohn Scipione 3012f746eafSJohn Scipione/*! 3022f746eafSJohn Scipione \fn bool BMenu::AddItem(BMenuItem* item, int32 index) 3032f746eafSJohn Scipione \brief Adds a menu \a item at the specified \a index. 3042f746eafSJohn Scipione 3052f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 3062f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 3072f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 3082f746eafSJohn Scipione 3092f746eafSJohn Scipione \param item The menu \a item to add. 3102f746eafSJohn Scipione \param index The \a index where to add the \a item to the menu. 3112f746eafSJohn Scipione 3122f746eafSJohn Scipione \return Whether or not the \a item was added to the menu. 3132f746eafSJohn Scipione*/ 3142f746eafSJohn Scipione 3152f746eafSJohn Scipione 3162f746eafSJohn Scipione/*! 3172f746eafSJohn Scipione \fn bool BMenu::AddItem(BMenuItem* item, BRect frame) 3182f746eafSJohn Scipione \brief Adds a menu \a item in the specified \a frame rectangle within the menu. 3192f746eafSJohn Scipione 3202f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_MATRIX 3212f746eafSJohn Scipione layout, it is an error to use this method for a menu in 3222f746eafSJohn Scipione \c B_ITEMS_IN_COLUMN or \c B_ITEMS_IN_ROW layout. 3232f746eafSJohn Scipione 3242f746eafSJohn Scipione \param item The menu \a item to add. 3252f746eafSJohn Scipione \param frame The \a frame rectangle where to add the \a item to the menu. 3262f746eafSJohn Scipione 3272f746eafSJohn Scipione \return Whether or not the \a item was added to the menu. 3282f746eafSJohn Scipione*/ 3292f746eafSJohn Scipione 3302f746eafSJohn Scipione 3312f746eafSJohn Scipione/*! 3322f746eafSJohn Scipione \fn bool BMenu::AddItem(BMenu* submenu) 3332f746eafSJohn Scipione \brief Add a \a submenu to the end of the list. 3342f746eafSJohn Scipione 3352f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 3362f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 3372f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 3382f746eafSJohn Scipione 3392f746eafSJohn Scipione \param submenu The submenu to add. 3402f746eafSJohn Scipione 3412f746eafSJohn Scipione \return Whether or not the \a submenu was added to the menu. 3422f746eafSJohn Scipione*/ 3432f746eafSJohn Scipione 3442f746eafSJohn Scipione 3452f746eafSJohn Scipione/*! 3462f746eafSJohn Scipione \fn bool BMenu::AddItem(BMenu* submenu, int32 index) 3472f746eafSJohn Scipione \brief Add a \a submenu at the specified \a index. 3482f746eafSJohn Scipione 3492f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 3502f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 3512f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 3522f746eafSJohn Scipione 3532f746eafSJohn Scipione \param submenu The \a submenu to add. 3542f746eafSJohn Scipione \param index The \a index where to add the \a submenu to the menu. 3552f746eafSJohn Scipione 3562f746eafSJohn Scipione \return Whether or not the \a submenu was added to the menu. 3572f746eafSJohn Scipione*/ 3582f746eafSJohn Scipione 3592f746eafSJohn Scipione 3602f746eafSJohn Scipione/*! 3612f746eafSJohn Scipione \fn bool BMenu::AddItem(BMenu* submenu, BRect frame) 3622f746eafSJohn Scipione \brief Adds a \a submenu in the specified \a frame rectangle within the 3632f746eafSJohn Scipione menu. 3642f746eafSJohn Scipione 3652f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_MATRIX 3662f746eafSJohn Scipione layout, it is an error to use this method for a menu in 3672f746eafSJohn Scipione \c B_ITEMS_IN_COLUMN or \c B_ITEMS_IN_ROW layout. 3682f746eafSJohn Scipione 3692f746eafSJohn Scipione \param submenu The submenu to add. 3702f746eafSJohn Scipione \param frame The \a frame rectangle where to add the submenu to the menu. 3712f746eafSJohn Scipione 3722f746eafSJohn Scipione \return Whether or not the \a submenu was added to the menu. 3732f746eafSJohn Scipione*/ 3742f746eafSJohn Scipione 3752f746eafSJohn Scipione 3762f746eafSJohn Scipione/*! 3772f746eafSJohn Scipione \fn bool BMenu::AddList(BList* list, int32 index) 3782f746eafSJohn Scipione \brief Add a \a list of menu items at the specified \a index. 3792f746eafSJohn Scipione 3802f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 3812f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 3822f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 3832f746eafSJohn Scipione 3842f746eafSJohn Scipione \param list The \a list of menu items to add. 3852f746eafSJohn Scipione \param index The \a index where to add the \a list to the menu. 3862f746eafSJohn Scipione 3872f746eafSJohn Scipione \return Whether or not the \a list of menu items was added to the menu. 3882f746eafSJohn Scipione*/ 3892f746eafSJohn Scipione 3902f746eafSJohn Scipione 3912f746eafSJohn Scipione/*! 3922f746eafSJohn Scipione \fn bool BMenu::AddSeparatorItem() 3932f746eafSJohn Scipione \brief Adds a separator item to the end of the menu. 3942f746eafSJohn Scipione 3952f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 3962f746eafSJohn Scipione layout, it is an error to use this method for a menu in 3972f746eafSJohn Scipione \c B_ITEMS_IN_ROW or \c B_ITEMS_IN_MATRIX layout. 3982f746eafSJohn Scipione 3992f746eafSJohn Scipione \return Whether or not the separator item was added to the menu. 4002f746eafSJohn Scipione*/ 4012f746eafSJohn Scipione 4022f746eafSJohn Scipione 4032f746eafSJohn Scipione/*! 4042f746eafSJohn Scipione \fn bool BMenu::RemoveItem(BMenuItem* item) 4052f746eafSJohn Scipione \brief Remove and delete the specified \a item from the menu. 4062f746eafSJohn Scipione 4072f746eafSJohn Scipione \return Whether or not the \a item was removed from the menu. 4082f746eafSJohn Scipione*/ 4092f746eafSJohn Scipione 4102f746eafSJohn Scipione 4112f746eafSJohn Scipione/*! 4122f746eafSJohn Scipione \fn BMenuItem* BMenu::RemoveItem(int32 index) 4132f746eafSJohn Scipione \brief Remove the item at the specified \a index from the menu. 4142f746eafSJohn Scipione 4152f746eafSJohn Scipione The menu item object is not deleted. 4162f746eafSJohn Scipione 4172f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 4182f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 4192f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 4202f746eafSJohn Scipione 4212f746eafSJohn Scipione \param index The \a index of where to remove the menu item. 4222f746eafSJohn Scipione 4232f746eafSJohn Scipione \return The menu item object or \c NULL if not found. 4242f746eafSJohn Scipione*/ 4252f746eafSJohn Scipione 4262f746eafSJohn Scipione 4272f746eafSJohn Scipione/*! 4282f746eafSJohn Scipione \fn bool BMenu::RemoveItems(int32 index, int32 count, bool deleteItems) 4292f746eafSJohn Scipione \brief Remove \a count number of items from the menu starting at the specified 4302f746eafSJohn Scipione \a index and delete them if \a deleteItems is \c true. 4312f746eafSJohn Scipione 4322f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 4332f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 4342f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 4352f746eafSJohn Scipione 4362f746eafSJohn Scipione \param index The \a index of where to start removing menu items. 4372f746eafSJohn Scipione \param count The number of items to remove. 4382f746eafSJohn Scipione \param deleteItems Whether or not to delete the items after removing them. 4392f746eafSJohn Scipione 4402f746eafSJohn Scipione \return Whether or not the items were removed from the menu. 4412f746eafSJohn Scipione*/ 4422f746eafSJohn Scipione 4432f746eafSJohn Scipione 4442f746eafSJohn Scipione/*! 4452f746eafSJohn Scipione \fn bool BMenu::RemoveItem(BMenu* submenu) 4462f746eafSJohn Scipione \brief Remove and delete a \a submenu from the menu. 4472f746eafSJohn Scipione 4482f746eafSJohn Scipione \param submenu The submenu to remove. 4492f746eafSJohn Scipione 4502f746eafSJohn Scipione \return Whether or not the \a submenu was removed from the menu. 4512f746eafSJohn Scipione*/ 4522f746eafSJohn Scipione 4532f746eafSJohn Scipione 4542f746eafSJohn Scipione/*! 4552f746eafSJohn Scipione \fn int32 BMenu::CountItems() const 4562f746eafSJohn Scipione \brief Returns the number of items added to the menu. 4572f746eafSJohn Scipione 4582f746eafSJohn Scipione \return The number of items added to the menu. 4592f746eafSJohn Scipione*/ 4602f746eafSJohn Scipione 4612f746eafSJohn Scipione 4622f746eafSJohn Scipione/*! 4632f746eafSJohn Scipione \fn BMenuItem* BMenu::ItemAt(int32 index) const 4642f746eafSJohn Scipione \brief Returns a pointer to the menu item at the specified \a index. 4652f746eafSJohn Scipione 4662f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 4672f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 4682f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 4692f746eafSJohn Scipione 4702f746eafSJohn Scipione \return A pointer to a menu item or \c NULL if not found. 4712f746eafSJohn Scipione*/ 4722f746eafSJohn Scipione 4732f746eafSJohn Scipione 4742f746eafSJohn Scipione/*! 4752f746eafSJohn Scipione \fn BMenu* BMenu::SubmenuAt(int32 index) const 4762f746eafSJohn Scipione \brief Returns a pointer to a submenu at the specified \a index. 4772f746eafSJohn Scipione 4782f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 4792f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for a 4802f746eafSJohn Scipione menu in \c B_ITEMS_IN_MATRIX layout. 4812f746eafSJohn Scipione 4822f746eafSJohn Scipione \return A pointer to a submenu or \c NULL if not found. 4832f746eafSJohn Scipione*/ 4842f746eafSJohn Scipione 4852f746eafSJohn Scipione 4862f746eafSJohn Scipione/*! 4872f746eafSJohn Scipione \fn int32 BMenu::IndexOf(BMenuItem* item) const 4882f746eafSJohn Scipione \brief Returns the index of the specified menu \a item. 4892f746eafSJohn Scipione 4902f746eafSJohn Scipione The index starts at the left for a menu in \c B_ITEMS_IN_COLUMN layout going 4912f746eafSJohn Scipione right or start at the top for a menu in \c B_ITEMS_IN_ROW layout going down. 4922f746eafSJohn Scipione 4932f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 4942f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 4952f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 4962f746eafSJohn Scipione 4972f746eafSJohn Scipione \return The index of the menu \a item or \c B_ERROR of not found. 4982f746eafSJohn Scipione*/ 4992f746eafSJohn Scipione 5002f746eafSJohn Scipione 5012f746eafSJohn Scipione/*! 5022f746eafSJohn Scipione \fn int32 BMenu::IndexOf(BMenu* submenu) const 5032f746eafSJohn Scipione \brief Returns the index of the specified \a submenu. 5042f746eafSJohn Scipione 5052f746eafSJohn Scipione The index starts at the left for a menu in \c B_ITEMS_IN_COLUMN layout going 5062f746eafSJohn Scipione right or at the top for a menu in \c B_ITEMS_IN_ROW layout going down. 5072f746eafSJohn Scipione 5082f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 5092f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 5102f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 5112f746eafSJohn Scipione 5122f746eafSJohn Scipione \return The index of the \a submenu or \c B_ERROR of not found. 5132f746eafSJohn Scipione*/ 5142f746eafSJohn Scipione 5152f746eafSJohn Scipione 5162f746eafSJohn Scipione/*! 5172f746eafSJohn Scipione \fn BMenuItem* BMenu::FindItem(const char* label) const 5182f746eafSJohn Scipione \brief Returns a pointer to the menu item with the specified \a label. 5192f746eafSJohn Scipione 5202f746eafSJohn Scipione \param label The \a label of the menu item to find. 5212f746eafSJohn Scipione 5222f746eafSJohn Scipione \return A pointer to a menu item or \c NULL if not found. 5232f746eafSJohn Scipione*/ 5242f746eafSJohn Scipione 5252f746eafSJohn Scipione 5262f746eafSJohn Scipione/*! 5272f746eafSJohn Scipione \fn BMenuItem* BMenu::FindItem(uint32 command) const 5282f746eafSJohn Scipione \brief Returns a pointer to the menu item with the specified \a command for 5292f746eafSJohn Scipione its associated message. 5302f746eafSJohn Scipione 5312f746eafSJohn Scipione \param command The \a command of the associated message of the menu item to 5322f746eafSJohn Scipione find. 5332f746eafSJohn Scipione 5342f746eafSJohn Scipione \return A pointer to a menu item or \c NULL if not found. 5352f746eafSJohn Scipione*/ 5362f746eafSJohn Scipione 5372f746eafSJohn Scipione 5382f746eafSJohn Scipione/*! 5392f746eafSJohn Scipione \fn status_t BMenu::SetTargetForItems(BHandler* handler) 5402f746eafSJohn Scipione \brief Set the target to \a handler for each item in the menu. 5412f746eafSJohn Scipione 5422f746eafSJohn Scipione This is a convenient way to set the target for all the items in a menu. 5432f746eafSJohn Scipione 5442f746eafSJohn Scipione \param handler The BHandler object to set the target of the menu item to. 5452f746eafSJohn Scipione 5462f746eafSJohn Scipione This method doesn't descend into submenus recursively and only acts on items 5472f746eafSJohn Scipione that have already been added to the menu. 5482f746eafSJohn Scipione 5492f746eafSJohn Scipione \return \c B_OK on success or an error code on error. 5502f746eafSJohn Scipione*/ 5512f746eafSJohn Scipione 5522f746eafSJohn Scipione 5532f746eafSJohn Scipione/*! 5542f746eafSJohn Scipione \fn status_t BMenu::SetTargetForItems(BMessenger messenger) 5552f746eafSJohn Scipione \brief Set the target to \a messenger for each item in the menu. 5562f746eafSJohn Scipione 5572f746eafSJohn Scipione This is a convenient way to set the target for all the items in a menu. 5582f746eafSJohn Scipione 5592f746eafSJohn Scipione This method doesn't descend into submenus recursively and only acts on items 5602f746eafSJohn Scipione that have already been added to the menu. 5612f746eafSJohn Scipione 5622f746eafSJohn Scipione \param messenger The BMessenger object to set the target of the menu item 5632f746eafSJohn Scipione to. 5642f746eafSJohn Scipione 5652f746eafSJohn Scipione \return \c B_OK on success or an error code on error. 5662f746eafSJohn Scipione*/ 5672f746eafSJohn Scipione 5682f746eafSJohn Scipione 5692f746eafSJohn Scipione/*! 5702f746eafSJohn Scipione \fn void BMenu::SetEnabled(bool enable) 5712f746eafSJohn Scipione \brief Enables or disables the menu. 5722f746eafSJohn Scipione 5732f746eafSJohn Scipione \param enable \c true to enable, \c false to disable. 5742f746eafSJohn Scipione*/ 5752f746eafSJohn Scipione 5762f746eafSJohn Scipione 5772f746eafSJohn Scipione/*! 5782f746eafSJohn Scipione \fn void BMenu::SetRadioMode(bool on) 5792f746eafSJohn Scipione \brief Turns radio mode on or off. 5802f746eafSJohn Scipione 5812f746eafSJohn Scipione Turning radio mode off also turns label-from-marked mode off. 5822f746eafSJohn Scipione 5832f746eafSJohn Scipione \param on \c true to turn radio mode on, \c false to turn it off. 5842f746eafSJohn Scipione*/ 5852f746eafSJohn Scipione 5862f746eafSJohn Scipione 5872f746eafSJohn Scipione/*! 5882f746eafSJohn Scipione \fn void BMenu::SetTriggersEnabled(bool enable) 5892f746eafSJohn Scipione \brief Enables or disables triggers. 5902f746eafSJohn Scipione 5912f746eafSJohn Scipione \param enable \c true to enable triggers, \c false to disable triggers. 5922f746eafSJohn Scipione*/ 5932f746eafSJohn Scipione 5942f746eafSJohn Scipione 5952f746eafSJohn Scipione/*! 5962f746eafSJohn Scipione \fn void BMenu::SetMaxContentWidth(float width) 5972f746eafSJohn Scipione \brief Sets the maximum width of the menu items' content area. 5982f746eafSJohn Scipione 5992f746eafSJohn Scipione This is the maximum width that a menu item can draw in. Note that menu 6002f746eafSJohn Scipione items have built-in margins on the left and right sides that are not 6012f746eafSJohn Scipione included as part of the maximum content width. 6022f746eafSJohn Scipione 6032f746eafSJohn Scipione \param width The maximum width for the menu item contents to draw in. 6042f746eafSJohn Scipione*/ 6052f746eafSJohn Scipione 6062f746eafSJohn Scipione 6072f746eafSJohn Scipione/*! 6082f746eafSJohn Scipione \fn void BMenu::SetLabelFromMarked(bool on) 6092f746eafSJohn Scipione \brief Sets whether or not the label of the menu is set according to the 6102f746eafSJohn Scipione marked item. 6112f746eafSJohn Scipione 6122f746eafSJohn Scipione Turning label-from-marked mode on also turns radio mode on. 6132f746eafSJohn Scipione 6142f746eafSJohn Scipione \param on \c true to turn label-from-marked mode on, \c false to turn it 6152f746eafSJohn Scipione off. 6162f746eafSJohn Scipione*/ 6172f746eafSJohn Scipione 6182f746eafSJohn Scipione 6192f746eafSJohn Scipione/*! 6202f746eafSJohn Scipione \fn bool BMenu::IsLabelFromMarked() 6212f746eafSJohn Scipione \brief Returns whether or not the menu is in label-from-marked mode. 6222f746eafSJohn Scipione 6232f746eafSJohn Scipione \return \c true if menu is in label-from-marked mode, \c false if not. 6242f746eafSJohn Scipione*/ 6252f746eafSJohn Scipione 6262f746eafSJohn Scipione 6272f746eafSJohn Scipione/*! 6282f746eafSJohn Scipione \fn bool BMenu::IsEnabled() const 6292f746eafSJohn Scipione \brief Returns whether or not the menu is enabled. 6302f746eafSJohn Scipione 6312f746eafSJohn Scipione \return \c true if menu is enabled, \c false if it is disabled. 6322f746eafSJohn Scipione*/ 6332f746eafSJohn Scipione 6342f746eafSJohn Scipione 6352f746eafSJohn Scipione/*! 6362f746eafSJohn Scipione \fn bool BMenu::IsRadioMode() const 6372f746eafSJohn Scipione \brief Returns whether or not the menu is in radio mode. 6382f746eafSJohn Scipione 6392f746eafSJohn Scipione \return \c true if menu is in radio mode, \c false if not. 6402f746eafSJohn Scipione*/ 6412f746eafSJohn Scipione 6422f746eafSJohn Scipione 6432f746eafSJohn Scipione/*! 6442f746eafSJohn Scipione \fn bool BMenu::AreTriggersEnabled() const 6452f746eafSJohn Scipione \brief Returns whether or not triggers are enabled. 6462f746eafSJohn Scipione 6472f746eafSJohn Scipione \return \c true if triggers are enabled, \c false if triggers are disabled. 6482f746eafSJohn Scipione*/ 6492f746eafSJohn Scipione 6502f746eafSJohn Scipione 6512f746eafSJohn Scipione/*! 6522f746eafSJohn Scipione \fn bool BMenu::IsRedrawAfterSticky() const 6532f746eafSJohn Scipione \brief Returns whether or not the menu is in redraw-after-sticky mode. 6542f746eafSJohn Scipione 6552f746eafSJohn Scipione \return \c true if menu is in redraw-after-sticky mode, \c false if not. 6562f746eafSJohn Scipione*/ 6572f746eafSJohn Scipione 6582f746eafSJohn Scipione 6592f746eafSJohn Scipione/*! 6602f746eafSJohn Scipione \fn float BMenu::MaxContentWidth() const 6612f746eafSJohn Scipione \brief Return the maximum width of the menu items' content area. 6622f746eafSJohn Scipione 6632f746eafSJohn Scipione \return The maximum width of the menu items' content area as a float. 6642f746eafSJohn Scipione*/ 6652f746eafSJohn Scipione 6662f746eafSJohn Scipione 6672f746eafSJohn Scipione/*! 6682f746eafSJohn Scipione \fn BMenuItem* BMenu::FindMarked() 6692f746eafSJohn Scipione \brief Return a pointer to the first marked menu item. 6702f746eafSJohn Scipione 6712f746eafSJohn Scipione The index starts at the left for a menu in \c B_ITEMS_IN_COLUMN layout going 6722f746eafSJohn Scipione right or at the top for a menu in \c B_ITEMS_IN_ROW layout going down. 6732f746eafSJohn Scipione 6742f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 6752f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 6762f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 6772f746eafSJohn Scipione 6782f746eafSJohn Scipione \return A pointer to the first marked menu item or \c NULL if not found. 6792f746eafSJohn Scipione*/ 6802f746eafSJohn Scipione 6812f746eafSJohn Scipione 6822f746eafSJohn Scipione/*! 6832f746eafSJohn Scipione \fn int32 BMenu::FindMarkedIndex() 6842f746eafSJohn Scipione \brief Return the index of the first marked menu item. 6852f746eafSJohn Scipione 6862f746eafSJohn Scipione The index starts at the left for a menu in \c B_ITEMS_IN_COLUMN layout going 6872f746eafSJohn Scipione right or at the top for a menu in \c B_ITEMS_IN_ROW layout going down. 6882f746eafSJohn Scipione 6892f746eafSJohn Scipione \warning This method should only be used for a menu in \c B_ITEMS_IN_COLUMN 6902f746eafSJohn Scipione or \c B_ITEMS_IN_ROW layout, it is an error to use this method for 6912f746eafSJohn Scipione a menu in \c B_ITEMS_IN_MATRIX layout. 6922f746eafSJohn Scipione 6932f746eafSJohn Scipione \return The index of the first marked menu item or -1 if not found. 6942f746eafSJohn Scipione*/ 6952f746eafSJohn Scipione 6962f746eafSJohn Scipione 6972f746eafSJohn Scipione/*! 6982f746eafSJohn Scipione \fn BMenu* BMenu::Supermenu() const 6992f746eafSJohn Scipione \brief Returns the pointer to the menu that this menu it attached to. 7002f746eafSJohn Scipione 7012f746eafSJohn Scipione \return A pointer to a BMenu object or \c NULL if not found. 7022f746eafSJohn Scipione*/ 7032f746eafSJohn Scipione 7042f746eafSJohn Scipione 7052f746eafSJohn Scipione/*! 7062f746eafSJohn Scipione \fn BMenuItem* BMenu::Superitem() const 7072f746eafSJohn Scipione \brief Returns the pointer to the menu item that this menu it attached to. 7082f746eafSJohn Scipione 7092f746eafSJohn Scipione \return A pointer to a BMenuItem object or \c NULL if not found. 7102f746eafSJohn Scipione*/ 7112f746eafSJohn Scipione 7122f746eafSJohn Scipione 7132f746eafSJohn Scipione/*! 7142f746eafSJohn Scipione \fn BMenu::BMenu(BRect frame, const char* name, uint32 resizingMode, 7152f746eafSJohn Scipione uint32 flags, menu_layout layout, bool resizeToFit) 7162f746eafSJohn Scipione \brief Implemented by derived classes to create a new menu object. 7172f746eafSJohn Scipione 7182f746eafSJohn Scipione This method is intended to be used by derived classes that don't simply wish 7192f746eafSJohn Scipione to utilize different sorts of menu items or arrange them in a different way, 7200d635255SJohn Scipione but wish to invent a different kind of menu altogether. 7212f746eafSJohn Scipione 7220d635255SJohn Scipione If the \a layout is set to \c B_ITEMS_IN_MATRIX the \a resizeToFit flag should 7230d635255SJohn Scipione be set to \c false. 7240d635255SJohn Scipione 7250d635255SJohn Scipione \param frame The \a frame rectangle to create the menu in. 7262f746eafSJohn Scipione \param name The menu's \a name, serves as a label for submenus. 7272f746eafSJohn Scipione \param resizingMode The resizing mode flags, see BView for more details. 7282f746eafSJohn Scipione \param flags The view \a flags, see BView for more details. 7292f746eafSJohn Scipione \param layout The menu layout, possibilities include: 7302f746eafSJohn Scipione - \c B_ITEMS_IN_ROW items are displayed in a single row, 7312f746eafSJohn Scipione - \c B_ITEMS_IN_COLUMN items are displayed in a single column, 7322f746eafSJohn Scipione - \c B_ITEMS_IN_MATRIX items are displayed in a custom matrix. 7332f746eafSJohn Scipione \param resizeToFit Whether or not the menu should automatically resize 7342f746eafSJohn Scipione itself to fit its contents, this will not work in 7352f746eafSJohn Scipione \c B_ITEMS_IN_MATRIX layout. 7362f746eafSJohn Scipione*/ 7372f746eafSJohn Scipione 7382f746eafSJohn Scipione 7392f746eafSJohn Scipione/*! 7402f746eafSJohn Scipione \fn void BMenu::SetItemMargins(float left, float top, float right, 7412f746eafSJohn Scipione float bottom) 7422f746eafSJohn Scipione \brief Set the menu item margins. 7432f746eafSJohn Scipione 7442f746eafSJohn Scipione \param left The left margin to set. 7452f746eafSJohn Scipione \param top The top margin to set. 7462f746eafSJohn Scipione \param right The right margin to set. 7472f746eafSJohn Scipione \param bottom The bottom margin to set. 7482f746eafSJohn Scipione*/ 7492f746eafSJohn Scipione 7502f746eafSJohn Scipione 7512f746eafSJohn Scipione/*! 7522f746eafSJohn Scipione \fn void BMenu::GetItemMargins(float* _left, float* _top, float* _right, 7532f746eafSJohn Scipione float* _bottom) const 7542f746eafSJohn Scipione \brief Fill out the margins into the passed in float pointers. 7552f746eafSJohn Scipione 7562f746eafSJohn Scipione \param _left The left margin to fill out, can be \c NULL. 7572f746eafSJohn Scipione \param _top The top margin to fill out, can be \c NULL. 7582f746eafSJohn Scipione \param _right The right margin to fill out, can be \c NULL. 7592f746eafSJohn Scipione \param _bottom The bottom margin to fill out, can be \c NULL. 7602f746eafSJohn Scipione*/ 7612f746eafSJohn Scipione 7622f746eafSJohn Scipione 7632f746eafSJohn Scipione/*! 7642f746eafSJohn Scipione \fn menu_layout BMenu::Layout() const 7652f746eafSJohn Scipione \brief Returns the current menu_layout constant. 7662f746eafSJohn Scipione*/ 7672f746eafSJohn Scipione 7682f746eafSJohn Scipione 7692f746eafSJohn Scipione/*! 7702f746eafSJohn Scipione \fn BMenuItem* BMenu::Track(bool sticky, BRect* clickToOpenRect) 7712f746eafSJohn Scipione \brief Initiates tracking the cursor within the menu. 7722f746eafSJohn Scipione 7732f746eafSJohn Scipione This method passes tracking control to submenus hierarchically depending on 7742f746eafSJohn Scipione where the user moves their mouse. 7752f746eafSJohn Scipione 7762f746eafSJohn Scipione You only need to call this method yourself if you are implementing a menu 7772f746eafSJohn Scipione that needs to track the cursor under nonstandard circumstances. 7782f746eafSJohn Scipione 7792f746eafSJohn Scipione \param sticky If \c true Track() leaves the menu open even after the mouse 7802f746eafSJohn Scipione button is no longer held down. 7812f746eafSJohn Scipione \param clickToOpenRect If \a sticky is \c true, leave the menu open even if 7822f746eafSJohn Scipione the user releases the mouse button while the cursor is inside 7832f746eafSJohn Scipione \a clickToOpenRect. 7842f746eafSJohn Scipione 7852f746eafSJohn Scipione \return A BMenuItem object if the user ends tracking by invoking an item or 7862f746eafSJohn Scipione \c NULL if the user didn't invoke an item. 7872f746eafSJohn Scipione*/ 7882f746eafSJohn Scipione 7892f746eafSJohn Scipione 7902f746eafSJohn Scipione/*! 7912f746eafSJohn Scipione \fn bool BMenu::AddDynamicItem(add_state state) 7922f746eafSJohn Scipione \brief Implemented by subclasses to Add a dynamic item to the menu. 7932f746eafSJohn Scipione 7942f746eafSJohn Scipione \param state Possibilities include: 7952f746eafSJohn Scipione - \c B_INITIAL_ADD, 7962f746eafSJohn Scipione - \c B_PROCESSING, 7972f746eafSJohn Scipione - \c B_ABORT 7982f746eafSJohn Scipione 7992f746eafSJohn Scipione \return \c true if the dynamic item was added, \c false otherwise. 8002f746eafSJohn Scipione*/ 8012f746eafSJohn Scipione 8022f746eafSJohn Scipione 8032f746eafSJohn Scipione/*! 8042f746eafSJohn Scipione \fn void BMenu::DrawBackground(BRect updateRect) 8052f746eafSJohn Scipione \brief Draw the menu background within the bounds of \a updateRect. 8062f746eafSJohn Scipione 8072f746eafSJohn Scipione \param updateRect The area to draw the background in. 8082f746eafSJohn Scipione*/ 8092f746eafSJohn Scipione 8102f746eafSJohn Scipione 8112f746eafSJohn Scipione/*! 8122f746eafSJohn Scipione \fn void BMenu::SetTrackingHook(menu_tracking_hook func, void* state) 8132f746eafSJohn Scipione \brief Sets a hook function that is called when tracking begins. 8142f746eafSJohn Scipione 8152f746eafSJohn Scipione \param func The hook function to call. 8162f746eafSJohn Scipione \param state A variable passed to the hook function. 8172f746eafSJohn Scipione*/ 8182f746eafSJohn Scipione 8192f746eafSJohn Scipione 8202f746eafSJohn Scipione/*! 8212f746eafSJohn Scipione \fn void BMenu::_DrawItems(BRect updateRect) 8222f746eafSJohn Scipione \brief Draw the menu items within \a updateRect. 8232f746eafSJohn Scipione 8242f746eafSJohn Scipione \param updateRect The area to draw the menu items in. 8252f746eafSJohn Scipione*/ 826