Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / XGUI / XGUI_MainMenu.h
1 #ifndef XGUI_MainMenu_H
2 #define XGUI_MainMenu_H
3
4 #include "XGUI.h"
5 #include <QObject>
6 #include <QList>
7 #include <QMap>
8
9 class XGUI_Command;
10 class XGUI_MainWindow;
11 class XGUI_Workbench;
12 class XGUI_MenuGroupPanel;
13
14 class QTabWidget;
15 class QLabel;
16 class QAction;
17 class QDockWidget;
18 class QEvent;
19
20
21 /**\class XGUI_MainMenu
22  * \ingroup GUI
23  * \brief Class for creation of main menu (set of workbenches)
24  */
25 class XGUI_EXPORT XGUI_MainMenu: public QObject
26 {
27 Q_OBJECT
28 public:
29   XGUI_MainMenu(XGUI_MainWindow *parent);
30   virtual ~XGUI_MainMenu();
31
32   //! Creates and adds a new workbench (menu group) with the given name and returns it.
33   XGUI_Workbench* addWorkbench(const QString& theId, const QString& theText = "");
34
35   //! Returns workbench (menu group) by the given name.
36   XGUI_Workbench* findWorkbench(const QString& theId);
37
38   //! Returns General page (predefined workbench)
39   XGUI_Workbench* generalPage() const { return myGeneralPage; }
40
41   //! Rerturns last created workbench in dock widget container
42   QDockWidget* getLastDockWindow() const { return myMenuTabs.last(); }
43
44   //! Returns already created command by its ID
45   XGUI_Command* feature(const QString& theId) const;
46
47   //! Returns list of created commands
48   QList<XGUI_Command*> features() const;
49
50 public slots:
51   void onFeatureChecked(bool);
52
53   void saveCommandsState();
54   void restoreCommandState();
55
56   virtual bool eventFilter(QObject *theWatched, QEvent *theEvent);
57
58 private:
59   XGUI_MainWindow* myDesktop;
60   QList<QDockWidget*> myMenuTabs;
61   XGUI_Workbench* myGeneralPage;
62
63   QMap<XGUI_Command*, bool> myCommandState;
64 };
65
66 #endif