Added help text functionality.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8117 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-06-22 02:52:38 +00:00
parent a104674fdf
commit 649f65cc3a
2 changed files with 20 additions and 1 deletions

View File

@ -43,6 +43,9 @@ class MenuItem {
void SetData(void *data);
void *Data() const { return fData; }
void SetHelpText(const char *text);
const char *HelpText() const { return fHelpText; }
const char *Label() const { return fLabel; }
Menu *Submenu() const { return fSubMenu; }
@ -59,6 +62,7 @@ class MenuItem {
menu_item_type fType;
Menu *fMenu, *fSubMenu;
void *fData;
const char *fHelpText;
};
typedef DoublyLinked::List<MenuItem> MenuItemList;

View File

@ -29,7 +29,8 @@ MenuItem::MenuItem(const char *label, Menu *subMenu)
fType(MENU_ITEM_STANDARD),
fMenu(NULL),
fSubMenu(subMenu),
fData(NULL)
fData(NULL),
fHelpText(NULL)
{
}
@ -101,6 +102,20 @@ MenuItem::SetData(void *data)
}
/** This sets a help text that is shown when the item is
* selected.
* Note, unlike the label, the string is not copied, it's
* just referenced and has to stay valid as long as the
* item's menu is being used.
*/
void
MenuItem::SetHelpText(const char *text)
{
fHelpText = text;
}
void
MenuItem::SetMenu(Menu *menu)
{