* Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36305 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2004-2010, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef KERNEL_BOOT_MENU_H
|
#ifndef KERNEL_BOOT_MENU_H
|
||||||
@@ -15,6 +15,7 @@ class MenuItem;
|
|||||||
|
|
||||||
typedef bool (*menu_item_hook)(Menu *, MenuItem *);
|
typedef bool (*menu_item_hook)(Menu *, MenuItem *);
|
||||||
|
|
||||||
|
|
||||||
enum menu_item_type {
|
enum menu_item_type {
|
||||||
MENU_ITEM_STANDARD = 1,
|
MENU_ITEM_STANDARD = 1,
|
||||||
MENU_ITEM_MARKABLE,
|
MENU_ITEM_MARKABLE,
|
||||||
@@ -23,9 +24,11 @@ enum menu_item_type {
|
|||||||
MENU_ITEM_SEPARATOR,
|
MENU_ITEM_SEPARATOR,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class MenuItem : public DoublyLinkedListLinkImpl<MenuItem> {
|
class MenuItem : public DoublyLinkedListLinkImpl<MenuItem> {
|
||||||
public:
|
public:
|
||||||
MenuItem(const char *label = NULL, Menu *subMenu = NULL);
|
MenuItem(const char* label = NULL,
|
||||||
|
Menu* subMenu = NULL);
|
||||||
~MenuItem();
|
~MenuItem();
|
||||||
|
|
||||||
void SetTarget(menu_item_hook target);
|
void SetTarget(menu_item_hook target);
|
||||||
@@ -56,20 +59,24 @@ class MenuItem : public DoublyLinkedListLinkImpl<MenuItem> {
|
|||||||
friend class Menu;
|
friend class Menu;
|
||||||
void SetMenu(Menu* menu);
|
void SetMenu(Menu* menu);
|
||||||
|
|
||||||
|
private:
|
||||||
const char* fLabel;
|
const char* fLabel;
|
||||||
menu_item_hook fTarget;
|
menu_item_hook fTarget;
|
||||||
bool fIsMarked;
|
bool fIsMarked;
|
||||||
bool fIsSelected;
|
bool fIsSelected;
|
||||||
bool fIsEnabled;
|
bool fIsEnabled;
|
||||||
menu_item_type fType;
|
menu_item_type fType;
|
||||||
Menu *fMenu, *fSubMenu;
|
Menu* fMenu;
|
||||||
|
Menu* fSubMenu;
|
||||||
const void* fData;
|
const void* fData;
|
||||||
const char* fHelpText;
|
const char* fHelpText;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef DoublyLinkedList<MenuItem> MenuItemList;
|
typedef DoublyLinkedList<MenuItem> MenuItemList;
|
||||||
typedef MenuItemList::Iterator MenuItemIterator;
|
typedef MenuItemList::Iterator MenuItemIterator;
|
||||||
|
|
||||||
|
|
||||||
enum menu_type {
|
enum menu_type {
|
||||||
MAIN_MENU = 1,
|
MAIN_MENU = 1,
|
||||||
SAFE_MODE_MENU,
|
SAFE_MODE_MENU,
|
||||||
@@ -77,6 +84,7 @@ enum menu_type {
|
|||||||
CHOICE_MENU,
|
CHOICE_MENU,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Menu {
|
class Menu {
|
||||||
public:
|
public:
|
||||||
Menu(menu_type type, const char* title = NULL);
|
Menu(menu_type type, const char* title = NULL);
|
||||||
@@ -104,11 +112,14 @@ class Menu {
|
|||||||
void RemoveItem(MenuItem* item);
|
void RemoveItem(MenuItem* item);
|
||||||
|
|
||||||
MenuItem* Superitem() const { return fSuperItem; }
|
MenuItem* Superitem() const { return fSuperItem; }
|
||||||
Menu *Supermenu() const { return fSuperItem ? fSuperItem->fMenu : NULL; }
|
Menu* Supermenu() const
|
||||||
|
{ return fSuperItem
|
||||||
|
? fSuperItem->fMenu : NULL; }
|
||||||
|
|
||||||
const char* Title() const { return fTitle; }
|
const char* Title() const { return fTitle; }
|
||||||
|
|
||||||
void SetChoiceText(const char *text) { fChoiceText = text; }
|
void SetChoiceText(const char* text)
|
||||||
|
{ fChoiceText = text; }
|
||||||
const char* ChoiceText() const { return fChoiceText; }
|
const char* ChoiceText() const { return fChoiceText; }
|
||||||
|
|
||||||
void Run();
|
void Run();
|
||||||
@@ -117,6 +128,7 @@ class Menu {
|
|||||||
friend class MenuItem;
|
friend class MenuItem;
|
||||||
void Draw(MenuItem* item);
|
void Draw(MenuItem* item);
|
||||||
|
|
||||||
|
private:
|
||||||
const char* fTitle;
|
const char* fTitle;
|
||||||
const char* fChoiceText;
|
const char* fChoiceText;
|
||||||
int32 fCount;
|
int32 fCount;
|
||||||
@@ -126,4 +138,5 @@ class Menu {
|
|||||||
MenuItem* fSuperItem;
|
MenuItem* fSuperItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* KERNEL_BOOT_MENU_H */
|
#endif /* KERNEL_BOOT_MENU_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user