]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROGUI/HYDROGUI_Module.h
Salome HOME
1) Show/Hide, Delete operations
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.h
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef HYDROGUI_MODULE_H
24 #define HYDROGUI_MODULE_H
25
26 #include <LightApp_Module.h>
27
28 #include <QEvent>
29
30 class GraphicsView_Viewer;
31
32 class SUIT_ViewWindow;
33
34 class HYDROGUI_DataModel;
35 class HYDROGUI_Displayer;
36
37 /**\class HYDROGUI_Module
38  *\brief The class representing the HYDROGUI module
39  */
40 class HYDROGUI_Module : public LightApp_Module
41 {
42   Q_OBJECT
43
44   enum CustomEvent { NewViewEvent = QEvent::User + 100 };
45
46 public:
47   HYDROGUI_Module();
48   virtual ~HYDROGUI_Module();
49
50   /**
51    * Returns the module study identifier
52    */
53   int getStudyId() const;
54
55   virtual void initialize( CAM_Application* );
56   virtual void windows( QMap<int, int>& ) const;
57   virtual void viewManagers( QStringList& ) const;
58
59   virtual void contextMenuPopup( const QString&, QMenu*, QString& );
60
61   virtual void update( const int );
62   virtual void updateCommandsStatus();
63
64   HYDROGUI_DataModel* getDataModel() const;
65   HYDROGUI_Displayer* getDisplayer() const;
66
67   GraphicsView_Viewer* getViewer( const int theViewerId ) const;
68
69 protected:
70   CAM_DataModel* createDataModel();
71
72 public slots:
73   virtual bool activateModule( SUIT_Study* );
74   virtual bool deactivateModule( SUIT_Study* );
75
76 protected:
77   virtual LightApp_Operation* createOperation( const int ) const;
78
79   virtual void customEvent( QEvent* );
80   virtual bool eventFilter( QObject*, QEvent* );
81
82 protected slots:
83   void onOperation();
84
85   bool onUndo( int theNumActions );
86   bool onRedo( int theNumActions );
87
88   virtual void onViewManagerAdded( SUIT_ViewManager* );
89   virtual void onViewManagerRemoved( SUIT_ViewManager* );
90   virtual void onViewCreated( SUIT_ViewWindow* );
91
92 private:
93   void updateGV( const bool theIsInit = false, 
94                  const bool theIsForced = false );
95
96   void createSelector( SUIT_ViewManager* viewMgr );
97
98   bool setUpdateEnabled( const bool theState );
99   bool isUpdateEnabled() const;
100
101 private:
102   void createActions();
103   void createMenus();
104   void createPopups();
105   void createToolbars();
106
107   void createUndoRedoActions();
108   void updateUndoRedoControls();
109
110 private:
111   QAction* createAction( const int theId, const QString& theSuffix,
112                          const QString& theImg = QString::null,
113                          const int theKey = 0, const bool isToggle = false,
114                          const QString& theSlot = QString::null );
115
116 private:
117   HYDROGUI_Displayer* myDisplayer;
118
119   bool myIsUpdateEnabled;
120 };
121
122 #endif