Choreonoid  1.8
MenuManager.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BASE_MENU_MANAGER_H
6 #define CNOID_BASE_MENU_MANAGER_H
7 
8 #include "Action.h"
9 #include "Menu.h"
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class CNOID_EXPORT MenuManager
15 {
16 public:
17  MenuManager();
18  MenuManager(QWidget* topMenu);
19  virtual ~MenuManager();
20 
21  void bindTextDomain(const std::string& domain);
22 
23  void setTopMenu(QWidget* topMenu);
24  QWidget* topMenu();
25 
26  void setNewPopupMenu(QWidget* parent = 0);
27  Menu* popupMenu();
28 
29  QWidget* current() const;
30  MenuManager& setCurrent(QWidget* menu);
31 
32  int numItems() const;
33 
34  QAction* findItem(const QString& path);
35  MenuManager& setPath(const QString& path);
36 
37  MenuManager& setBackwardMode();
38 
39  void addAction(QAction* action);
40 
41  Action* addItem(const QString& text);
42  Action* addItem(const std::string& text);
43  Action* addItem(const char* text);
44  Action* addCheckItem(const QString& text);
45  Action* addRadioItem(QActionGroup* group, const QString& text);
46 
47  MenuManager& addSeparator();
48 
49 private:
50  MenuManager(const MenuManager* org);
51  QWidget* topMenu_;
52  QWidget* currentMenu_;
53  Menu* popupMenu_;
54  bool isBackwardMode;
55  std::string textDomain;
56 
57  std::pair<QAction*, QWidget*> findPath(const QString& path, bool createPath);
58  void addItem(QWidget* menu, QAction* item);
59 };
60 
61 }
62 
63 #endif
cnoid::Action
Definition: Action.h:14
Menu.h
Action.h
cnoid::MenuManager
Definition: MenuManager.h:14
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Menu
Definition: Menu.h:14