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 #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   //! Size of menu item
30   //TODO(sbh, vsv): Move to the settings
31   //enum ItemSize {
32   //  Small = 20,
33   //  Medium = 25,
34   //  Large = 30
35   //};
36
37 public:
38   XGUI_MainMenu(XGUI_MainWindow *parent);
39   virtual ~XGUI_MainMenu();
40
41   //! Creates and adds a new workbench (menu group) with the given name and returns it.
42   XGUI_Workbench* addWorkbench(const QString& theId, const QString& theText = "");
43
44   //! Returns workbench (menu group) by the given name.
45   XGUI_Workbench* findWorkbench(const QString& theId)  const;
46
47   //! Returns General page (predefined workbench)
48   XGUI_MenuGroupPanel* generalPage() const { return myGeneralPage; }
49
50   //! Rerturns last created workbench in dock widget container
51   //QDockWidget* getLastDockWindow() const;
52
53   //! Returns already created command by its ID
54   XGUI_Command* feature(const QString& theId) const;
55
56   //! Returns list of created commands
57   QList<XGUI_Command*> features() const;
58
59   virtual bool eventFilter(QObject *theWatched, QEvent *theEvent);
60
61   //! Displays given console as a tab in the workbench
62   void insertConsole(QWidget*);
63   //! Removes already created tab with python console
64   void removeConsole();
65
66   //! Defines size of menu item.
67   //! In the future this value should be extracted from the preferences.
68   int menuItemSize() const;
69   //! Defines number of menu item rows.
70   //! In the future this value should be extracted from the preferences.
71   int menuItemRowsCount() const;
72   //! Defines height of the main menu. (Number of rows * row height)
73   int menuHeight() const;
74
75   void updateFromResources();
76
77 private:
78   XGUI_MainWindow* myDesktop;
79   QTabWidget* myMenuTabs;
80   XGUI_MenuGroupPanel* myGeneralPage;
81
82   QMap<XGUI_Command*, bool> myCommandState;
83 };
84
85 #endif