Salome HOME
Make property panel as a GUI of an operation
[modules/shaper.git] / src / XGUI / XGUI_MainMenu.h
index 3521be3c09584ab8b9b81f09f2e971c53380ab3e..50c19c8a985e6c2b6ccc54f0f16dbe6d407044b0 100644 (file)
@@ -1,33 +1,81 @@
 #ifndef XGUI_MainMenu_H
 #define XGUI_MainMenu_H
 
+#include "XGUI.h"
 #include <QObject>
 #include <QList>
+#include <QMap>
+#include <QWidget>
+
+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 QWidget
 {
-    Q_OBJECT
-public:
-    XGUI_MainMenu(XGUI_MainWindow *parent);
-    virtual ~XGUI_MainMenu();
+Q_OBJECT
+
+ public:
+  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 = "");
+
+  //! Returns workbench (menu group) by the given name.
+  XGUI_Workbench* findWorkbench(const QString& theId) const;
+
+  //! Returns General page (predefined workbench)
+  XGUI_MenuGroupPanel* generalPage() const
+  {
+    return myGeneralPage;
+  }
+
+  //! Rerturns last created workbench in dock widget container
+  //QDockWidget* getLastDockWindow() const;
+
+  //! Returns already created command by its ID
+  XGUI_Command* feature(const QString& theId) const;
+
+  //! Returns list of created commands
+  QList<XGUI_Command*> features() const;
+
+  virtual bool eventFilter(QObject *theWatched, QEvent *theEvent);
+
+  //! Displays given console as a tab in the workbench
+  void insertConsole(QWidget*);
+  //! Removes already created tab with python console
+  void removeConsole();
 
-    int addWorkbench(QString theTitle);
+  //! Defines size of menu item.
+  //! In the future this value should be extracted from the preferences.
+  int menuItemSize() const;
+  //! Defines number of menu item rows.
+  //! In the future this value should be extracted from the preferences.
+  int menuItemRowsCount() const;
+  //! Defines height of the main menu. (Number of rows * row height)
+  int menuHeight() const;
 
-    int addGroup(int thePageId);
+  void updateFromResources();
 
-    void addCommand(int thePageId, int theGroupId, XGUI_Command* theCommand);
+ private:
+  XGUI_MainWindow* myDesktop;
+  QTabWidget* myMenuTabs;
+  XGUI_MenuGroupPanel* myGeneralPage;
+  QList<XGUI_Workbench*> myWorkbenches;
 
-private:
-    XGUI_MainWindow* myDesktop;
-    QList<QDockWidget*> myMenuTabs;
+  QMap<XGUI_Command*, bool> myCommandState;
 };
 
 #endif