]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_MainMenu.h
Salome HOME
4c3f0ec675cc2821cd6730120a0cef534cd7fd9a
[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 #include <QWidget>
9
10 class XGUI_Command;
11 class XGUI_MainWindow;
12 class XGUI_Workbench;
13 class XGUI_MenuGroupPanel;
14
15 class QTabWidget;
16 class QLabel;
17 class QAction;
18 class QDockWidget;
19 class QEvent;
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 QWidget
26 {
27   Q_OBJECT
28
29 public:
30   XGUI_MainMenu(XGUI_MainWindow *parent);
31   virtual ~XGUI_MainMenu();
32
33   //! Creates and adds a new workbench (menu group) with the given name and returns it.
34   XGUI_Workbench* addWorkbench(const QString& theId, const QString& theText = "");
35
36   //! Returns workbench (menu group) by the given name.
37   XGUI_Workbench* findWorkbench(const QString& theId)  const;
38
39   //! Returns General page (predefined workbench)
40   XGUI_MenuGroupPanel* generalPage() const { return myGeneralPage; }
41
42   //! Rerturns last created workbench in dock widget container
43   //QDockWidget* getLastDockWindow() const;
44
45   //! Returns already created command by its ID
46   XGUI_Command* feature(const QString& theId) const;
47
48   //! Returns list of created commands
49   QList<XGUI_Command*> features() const;
50
51   virtual bool eventFilter(QObject *theWatched, QEvent *theEvent);
52
53   //! Displays given console as a tab in the workbench
54   void insertConsole(QWidget*);
55   //! Removes already created tab with python console
56   void removeConsole();
57
58   //! Defines size of menu item.
59   //! In the future this value should be extracted from the preferences.
60   int menuItemSize() const;
61   //! Defines number of menu item rows.
62   //! In the future this value should be extracted from the preferences.
63   int menuItemRowsCount() const;
64   //! Defines height of the main menu. (Number of rows * row height)
65   int menuHeight() const;
66
67   void updateFromResources();
68
69 private:
70   XGUI_MainWindow* myDesktop;
71   QTabWidget* myMenuTabs;
72   XGUI_MenuGroupPanel* myGeneralPage;
73   QList<XGUI_Workbench*> myWorkbenches;
74
75   QMap<XGUI_Command*, bool> myCommandState;
76 };
77
78 #endif