Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

SubMenu.h

Go to the documentation of this file.
00001 //     $Id: SubMenu.h,v 1.1.1.1 2001/01/04 01:01:11 burnett Exp $
00002 //  Author: Toby Burnett
00003 //
00004 
00005 #ifndef SUBMENU_H
00006 #define SUBMENU_H
00007 #include <string>
00008 #include "gui/Command.h"
00009 #include "gui/Menu.h"
00010 
00011 namespace gui{
00012 
00013 class SubMenu {
00014     // Handles commands in a nested pull-down menu, either from the menu bar, or of a submenu
00015 public:
00016     void addButton(const std::string& label, Command* command);
00017     // add a simple button, with name label. Calls the command when struck
00018 
00019     GUI::Toggle* addToggle(const std::string& label, bool state, Command* set, Command* unset);
00020     // add a toggle button, initialy set if state is true. the comands set and unset are
00021     // called depending on the current state 
00022     // return pointer to object that can be used to access the state
00023 
00024     void addSeparator();
00025     // add a separator
00026 
00027     SubMenu& subMenu(const std::string& label);
00028     // Return a nested SubMenu for this submenu
00029 
00030     const Menu::Node* tag()const{ return m_tag;} 
00031     // return tag assigned by the windowing system, a pointer to something that the 
00032     // client must cast
00033 
00034 private:
00035     friend class Menu; // only Menu has access to the constructor
00036     SubMenu(Menu& m,    const std::string& label);
00037     SubMenu(Menu& m, SubMenu* s, const std::string& label);
00038 
00039     Menu& m_menu;       // top level menu bar
00040     SubMenu* m_subMenu; // parent submenu, null if parent is menu
00041     Menu::Node* m_tag;  // used to communicate with real gui
00042 };
00043 } //gui
00044 
00045 #endif //SUBMENU

Generated at Wed Nov 21 12:20:55 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000