Salome HOME
Issue #218 Disable stratch is expandable object is in the panel
[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   //! Python console can be a dock widget 
48   void dockPythonConsole();
49   //! or can be a tab in the main menu.
50   void undockPythonConsole();
51
52   void createSubWindow();
53
54   /// Add name of current directory into title of desktop window
55   void setCurrentDir(const QString& theDir, bool toUpdate = true);
56
57   /// Add asterisk to a title of the window
58   void setModifiedState(bool isModified, bool toUpdate = true);
59
60   /// Returns current state of modification
61   bool isModifiedState() const { return myIsModified; }
62
63   void updateTitle();
64
65  private slots:
66   void cascadeWindows();
67   void onViewCreated(XGUI_ViewWindow* theWindow);
68   void onDeleteView(XGUI_ViewWindow* theWindow);
69   void activateView();
70   void onViewActivated(QMdiSubWindow* theSubWnd);
71
72 signals:
73   void exitKeySequence();
74
75  protected:
76   void closeEvent(QCloseEvent* event);
77   void createMainMenu();
78
79  private:
80   XGUI_MainMenu* myMenuBar;
81   XGUI_Viewer* myViewer;
82
83   QString myTitle;
84   QString myCurrentDir;
85   bool myIsModified;
86
87   PyConsole_EnhConsole* myPythonConsole;
88 };
89
90 class XGUI_EXPORT CloseEventWatcher : public QObject
91 {
92 Q_OBJECT
93
94  public:
95   CloseEventWatcher(QObject* theParent);
96
97 signals:
98   void widgetClosed();
99
100  protected:
101   bool eventFilter(QObject *obj, QEvent *);
102
103 };
104
105 #endif