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:
parent
a104674fdf
commit
649f65cc3a
@ -43,6 +43,9 @@ class MenuItem {
|
|||||||
void SetData(void *data);
|
void SetData(void *data);
|
||||||
void *Data() const { return fData; }
|
void *Data() const { return fData; }
|
||||||
|
|
||||||
|
void SetHelpText(const char *text);
|
||||||
|
const char *HelpText() const { return fHelpText; }
|
||||||
|
|
||||||
const char *Label() const { return fLabel; }
|
const char *Label() const { return fLabel; }
|
||||||
Menu *Submenu() const { return fSubMenu; }
|
Menu *Submenu() const { return fSubMenu; }
|
||||||
|
|
||||||
@ -59,6 +62,7 @@ class MenuItem {
|
|||||||
menu_item_type fType;
|
menu_item_type fType;
|
||||||
Menu *fMenu, *fSubMenu;
|
Menu *fMenu, *fSubMenu;
|
||||||
void *fData;
|
void *fData;
|
||||||
|
const char *fHelpText;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef DoublyLinked::List<MenuItem> MenuItemList;
|
typedef DoublyLinked::List<MenuItem> MenuItemList;
|
||||||
|
@ -29,7 +29,8 @@ MenuItem::MenuItem(const char *label, Menu *subMenu)
|
|||||||
fType(MENU_ITEM_STANDARD),
|
fType(MENU_ITEM_STANDARD),
|
||||||
fMenu(NULL),
|
fMenu(NULL),
|
||||||
fSubMenu(subMenu),
|
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
|
void
|
||||||
MenuItem::SetMenu(Menu *menu)
|
MenuItem::SetMenu(Menu *menu)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user