Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_MainWindow.h
1 #ifndef XGUI_MAINWINDOW_H
2 #define XGUI_MAINWINDOW_H
3
4 #include "XGUI.h"
5 #include <QMainWindow>
6
7 class XGUI_MainMenu;
8 class XGUI_Viewer;
9 class XGUI_ActionsMgr;
10 class XGUI_ViewWindow;
11 class QMdiArea;
12 class QMdiSubWindow;
13 class PyConsole_EnhConsole;
14 class QCloseEvent;
15
16 /**\class XGUI_MainWindow
17  * \ingroup GUI
18  * \brief Main window of the application (Desktop).
19  * It contains: Object Browser, 3d Viewer, Python console, property panel, main menu
20  */
21 class XGUI_EXPORT XGUI_MainWindow: public QMainWindow
22 {
23 Q_OBJECT
24
25 public:
26   XGUI_MainWindow(QWidget* parent = 0);
27   virtual ~XGUI_MainWindow();
28
29   //! Returns main menu object
30   XGUI_MainMenu* menuObject() const
31   {
32     return myMenuBar;
33   }
34
35   //! Returns MDI area
36   QMdiArea* mdiArea() const;
37
38   //! Returns 3d viewer
39   XGUI_Viewer* viewer() const
40   {
41     return myViewer;
42   }
43
44 public slots:
45   void showPythonConsole();
46   void hidePythonConsole();
47   void dockPythonConsole();
48   void undockPythonConsole();
49
50   void createSubWindow();
51   
52 private slots:
53   void cascadeWindows();
54   void onViewCreated(XGUI_ViewWindow* theWindow);
55   void onDeleteView(XGUI_ViewWindow* theWindow);
56   void activateView();
57   void onViewActivated(QMdiSubWindow* theSubWnd);
58
59 signals:
60   void exitKeySequence();
61
62 protected:
63   void closeEvent(QCloseEvent* event);
64   void createMainMenu();
65
66 private:
67   XGUI_MainMenu* myMenuBar;
68   XGUI_Viewer* myViewer;
69
70   PyConsole_EnhConsole* myPythonConsole;
71   //! Python console can be a dock widget if true, else as the tab.
72   bool myIsConsoleDocked;
73 };
74
75 class XGUI_EXPORT CloseEventWatcher: public QObject {
76   Q_OBJECT
77
78  public:
79   CloseEventWatcher(QObject* theParent);
80
81  signals:
82   void widgetClosed();
83
84  protected:
85   bool eventFilter(QObject *obj, QEvent *);
86
87 };
88
89 #endif