Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents a dropdown menu that contains a series of menu items. More...
#include <omGUIMenu.h>
Classes | |
class | Delegate |
A class that contains function objects that recieve menu events. More... | |
Public Member Functions | |
Menu () | |
Create a new menu with no name and no menu items. More... | |
Menu (const UTF8String &name) | |
Create a new menu with the specified name (title), and no menu items. More... | |
~Menu () | |
Destroy a Menu object and all state associated with it. More... | |
Size | getItemCount () const |
Return the number of menu items that this Menu has. More... | |
MenuItem * | getItem (Index index) const |
Return a pointer to the menu item at the specified index in the Menu. More... | |
Bool | getItemIndex (const MenuItem *item, Index &index) const |
Place the index of the specified menu item in the output parameter and return if it was found. More... | |
Bool | addItem (MenuItem *newItem) |
Add the specified MenuItem to the end of the list of items, placing it at the bottom of the Menu. More... | |
Bool | insertItem (Index index, MenuItem *newItem) |
Insert the specified MenuItem at the specified item index in this menu. More... | |
Bool | setItem (Index index, MenuItem *newItem) |
Set the specified MenuItem at the specified index in the list of menu items. More... | |
Bool | removeItem (const MenuItem *item) |
Remove the specified MenuItem from this Menu. More... | |
Bool | removeItemAtIndex (Index index) |
Remove the menu item at the specified index in the menu item list. More... | |
void | clearItems () |
Remove all menu items from this menu. More... | |
UTF8String | getName () const |
Return the name (title) of this Menu. More... | |
void | setName (const UTF8String &newName) |
Set the name (title) of this Menu. More... | |
Bool | isOpen () const |
Return whether or not the menu is currently open, with the user in the process of selecting an item. More... | |
Bool | open (const Vector2i &position) |
Display the menu as a context menu at the specified position in the screen coordinate system. More... | |
Bool | open (const Vector2i &position, const View &view) |
Display the menu as a context menu at the specified position in a view's local coordinate system. More... | |
Delegate & | getDelegate () |
Return a reference to the delegate object associated with this menu. More... | |
const Delegate & | getDelegate () const |
Return a const reference to the delegate object associated with this menu. More... | |
void | setDelegate (const Delegate &delegate) |
Set the delegate object to which this menu item sends events. More... | |
MenuBar * | getParentMenuBar () const |
Return a pointer to the menu bar that this menu belongs to. More... | |
Bool | hasParentMenuBar () const |
Return whether or not this menu is part of a menu bar. More... | |
MenuItem * | getParentMenuItem () const |
Return a pointer to the menu item that this menu belongs to. More... | |
Bool | hasParentMenuItem () const |
Return whether or not this menu is a submenu of a menu item. More... | |
Bool | hasParent () const |
Return whether or not this menu has either a parent menu bar or parent menu item. More... | |
virtual void * | getInternalPointer () const |
Get a pointer to this menu's platform-specific internal representation. More... | |
Public Member Functions inherited from om::gui::objects::GUIObject | |
virtual | ~GUIObject () |
Destroy a GUI element and release all resources associated with it. More... | |
A class that represents a dropdown menu that contains a series of menu items.
om::gui::objects::Menu::Menu | ( | ) |
Create a new menu with no name and no menu items.
om::gui::objects::Menu::Menu | ( | const UTF8String & | name | ) |
Create a new menu with the specified name (title), and no menu items.
om::gui::objects::Menu::~Menu | ( | ) |
Destroy a Menu object and all state associated with it.
The destructor for a menu should not be called until it is not being used as part of any active GUI.
Size om::gui::objects::Menu::getItemCount | ( | ) | const |
Return the number of menu items that this Menu has.
Return a pointer to the menu item at the specified index in the Menu.
If the specified index is invalid, a NULL pointer is returned.
index | - the index of the menu item to be retrieved. |
Place the index of the specified menu item in the output parameter and return if it was found.
If the menu contains the specified menu item, it places the index of that item in the output index parameter and returns TRUE. Otherwise, if the menu item is not found, the method returns FALSE and no index is retrieved.
Add the specified MenuItem to the end of the list of items, placing it at the bottom of the Menu.
If the new menu item pointer is NULL, the add operation is ignored and FALSE is returned. Otherwise, the menu item is added and TRUE is returned, indicating success.
newItem | - the menu item to add to the end of the menu item list. |
Insert the specified MenuItem at the specified item index in this menu.
If the new menu item pointer is NULL or if the specified insertion index is greater than the number of items in the menu, FALSE is returned indicating that the insertion operation failed. Otherwise, TRUE is returned and the item is inserted at the specified index.
newItem | - the menu item to insert in the menu item list. |
index | - the index in the menu item list at which to insert the new item. |
Set the specified MenuItem at the specified index in the list of menu items.
This method replaces the menu item at the specified index with a new menu item. If the new menu item pointer is NULL, the set operation is ignored.
newItem | - the menu item to set in the menu item list. |
index | - the index at which to set the new item. |
Remove the specified MenuItem from this Menu.
If the menu item pointer is NULL or if the specified item is not contained in this menu, FALSE is returned indicating failure. Otherwise, that menu item is removed and TRUE is returned.
item | - the menu item to remove from the menu item list. |
Remove the menu item at the specified index in the menu item list.
If the specified index is invalid, FALSE is returned and the Menu is unaltered. Otherwise, the item at that index is removed and TRUE is returned.
index | - the index at which to remove a menu item from the menu. |
void om::gui::objects::Menu::clearItems | ( | ) |
Remove all menu items from this menu.
UTF8String om::gui::objects::Menu::getName | ( | ) | const |
Return the name (title) of this Menu.
void om::gui::objects::Menu::setName | ( | const UTF8String & | newName | ) |
Set the name (title) of this Menu.
Bool om::gui::objects::Menu::isOpen | ( | ) | const |
Return whether or not the menu is currently open, with the user in the process of selecting an item.
Bool om::gui::objects::Menu::open | ( | const Vector2i & | position | ) |
Display the menu as a context menu at the specified position in the screen coordinate system.
Display the menu as a context menu at the specified position in a view's local coordinate system.
Delegate& om::gui::objects::Menu::getDelegate | ( | ) |
Return a reference to the delegate object associated with this menu.
const Delegate& om::gui::objects::Menu::getDelegate | ( | ) | const |
Return a const reference to the delegate object associated with this menu.
void om::gui::objects::Menu::setDelegate | ( | const Delegate & | delegate | ) |
Set the delegate object to which this menu item sends events.
MenuBar* om::gui::objects::Menu::getParentMenuBar | ( | ) | const |
Return a pointer to the menu bar that this menu belongs to.
This method returns a NULL pointer if the menu doesn't have a parent menu bar. Use the hasParentMenuBar() function to detect if the menu has a parent menu bar.
Bool om::gui::objects::Menu::hasParentMenuBar | ( | ) | const |
Return whether or not this menu is part of a menu bar.
MenuItem* om::gui::objects::Menu::getParentMenuItem | ( | ) | const |
Return a pointer to the menu item that this menu belongs to.
This method returns a NULL pointer if the menu doesn't have a parent menu item. Use the hasParentMenuItem() function to detect if the menu has a parent menu item.
Bool om::gui::objects::Menu::hasParentMenuItem | ( | ) | const |
Return whether or not this menu is a submenu of a menu item.
Bool om::gui::objects::Menu::hasParent | ( | ) | const |
Return whether or not this menu has either a parent menu bar or parent menu item.
|
virtual |
Get a pointer to this menu's platform-specific internal representation.
On Mac OS X, this method returns a pointer to a subclass of NSMenu which represents the menu.
On Windows, this method returns an HMENU representing the menu.
Implements om::gui::objects::GUIObject.