Adding New GraphWin MenusNew menus can be added to existing menus of GraphWin or the main menu bar by calling theadd_menu () operation. Each
menu is represented by an integer (menu_id ) from an internal
numbering of all menus. The main menu has number zero.
int gw.add_menu(GraphWin& gw, string label, int menu_id=0);creates a sub-menu with label label in the menu with id menu_id .
The id of the new menu is returned. The menu id of a standard menu can be
obtained by calling get_menu(string) with the name of the menu,
e.g.,
gw.get_menu("Help"); ExampleThe following simple example shows how to add (sub-) menu to a GraphWin. #include <LEDA/graphics/graphwin.h> using namespace leda; int main() { GraphWin gw; int menu1 = gw.add_menu("components"); gw.add_menu("simply connected", menu1); gw.add_menu("strongly connected", menu1); gw.add_menu("biconnected", menu1); gw.display(); gw.edit(); return 0; } |
See also:Customizing the Interactive Interface Complete Example for Customizing the Interface Manual Pages: |