Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / XGUI / XGUI_MainMenu.h
index ef4dc0511dcda16b15ede7435f39470f62503ff0..0fed1a07ff64a11c83d68665cd2b1e11b11aac21 100644 (file)
@@ -1,33 +1,66 @@
 #ifndef XGUI_MainMenu_H
 #define XGUI_MainMenu_H
 
-#include "XGUI_Interfaces.h"
-
+#include "XGUI.h"
 #include <QObject>
 #include <QList>
+#include <QMap>
+
+class XGUI_Command;
+class XGUI_MainWindow;
+class XGUI_Workbench;
+class XGUI_MenuGroupPanel;
 
 class QTabWidget;
 class QLabel;
 class QAction;
-class XGUI_Command;
-class XGUI_MainWindow;
 class QDockWidget;
+class QEvent;
 
 
-class XGUI_MainMenu : public QObject
+/**\class XGUI_MainMenu
+ * \ingroup GUI
+ * \brief Class for creation of main menu (set of workbenches)
+ */
+class XGUI_EXPORT XGUI_MainMenu: public QObject
 {
-    Q_OBJECT
+Q_OBJECT
 public:
-    XGUI_MainMenu(XGUI_MainWindow *parent);
-    virtual ~XGUI_MainMenu();
+  XGUI_MainMenu(XGUI_MainWindow *parent);
+  virtual ~XGUI_MainMenu();
+
+  //! Creates and adds a new workbench (menu group) with the given name and returns it.
+  XGUI_Workbench* addWorkbench(const QString& theId, const QString& theText = "");
 
-    IWorkbench* addWorkbench(QString theTitle);
+  //! Returns workbench (menu group) by the given name.
+  XGUI_Workbench* findWorkbench(const QString& theId);
 
-    IMenuGroup* addGroup(int thePageId);
+  //! Returns General page (predefined workbench)
+  XGUI_Workbench* generalPage() const { return myGeneralPage; }
+
+  //! Rerturns last created workbench in dock widget container
+  QDockWidget* getLastDockWindow() const { return myMenuTabs.last(); }
+
+  //! Returns already created command by its ID
+  XGUI_Command* feature(const QString& theId) const;
+
+  //! Returns list of created commands
+  QList<XGUI_Command*> features() const;
+
+public slots:
+  void onFeatureChecked(bool);
+
+  void saveCommandsState();
+  void restoreCommandState();
+
+  virtual bool eventFilter(QObject *theWatched, QEvent *theEvent);
 
 private:
-    XGUI_MainWindow* myDesktop;
-    QList<QDockWidget*> myMenuTabs;
+  XGUI_MainWindow* myDesktop;
+  QList<QDockWidget*> myMenuTabs;
+  XGUI_Workbench* myGeneralPage;
+
+  QMap<XGUI_Command*, bool> myCommandState;
 };
 
 #endif