Simple Graphics Library
0.9.5
SGL API
|
#include <sgl.h>
Classes | |
struct | MenuItem |
Public Member Functions | |
PopupMenu () | |
virtual | ~PopupMenu () |
virtual void | add_menu_item (const std::string &item, MenuItemFunction func) |
virtual void | replace_menu_item (const std::string &old_name, const std::string &new_name, MenuItemFunction func) |
virtual void | remove_menu_item (const std::string &item) |
virtual void | execute_handler (int n) |
virtual void | activate () |
Static Protected Member Functions | |
static void | process_menu_events (int option) |
Protected Attributes | |
int | index |
std::vector< MenuItem > | items |
Implements a popup menu. Each popup menu must be associated with a particular window.
sgl::PopupMenu::PopupMenu | ( | ) |
Intializes an empty popup menu.
|
virtual |
Destroys a popup menu
|
virtual |
Make this popup menu the active popup for its window.
|
virtual |
Specifies which method to call for a given menu item. Clients ordinarily will use the add_menu_item macro so a messy type cast is no necessary.
item | a string listed for the menu choice |
func | a method to call when the user selects the given menu item |
|
virtual |
Invokes the proper handler when the user selects an item in a popup menu. Client ordinarily do not call this method directly, nor do they override it.
n | an index into the table of handlers maintained by this popup menu |
|
staticprotected |
Calls the proper handler for the user's selection
|
virtual |
Removes a menu item and its associated handler. The current menu item name is supplied.
item | a string listed for the current menu choice |
|
virtual |
Replaces one menu item and its associated handler with another. The current menu item name is supplied along with the new menu item name and the new handler.
old_name | a string listed for the current menu choice |
new_name | a string listed for the replacement menu choice |
func | the replacement handler for this menu item |
|
protected |
The window associated with this popup menu
|
protected |
Collection of menu items