Salome HOME
Imported sources
[modules/paravis.git] / src / PVGUI / PVGUI_ProcessModuleHelper.h
1 // PARAVIS : ParaView wrapper SALOME module
2 //
3 // Copyright (C) 2003  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 // File   : PVGUI_ProcessModuleHelper.h
23 // Author : Sergey ANIKIN
24 //
25
26 #ifndef PVGUI_ProcessModuleHelper_H
27 #define PVGUI_ProcessModuleHelper_H
28
29 #include <pqProcessModuleGUIHelper.h>
30
31 /*! 
32   \class PVGUI_ProcessModuleHelper
33   The key element of ParaView integration into SALOME GUI.
34   Sub-classes pqProcessModuleGUIHelper with the following main features:
35   \li No main window is created by this class
36   \li Qt event loop is run outside this class
37   \li ParaView messages are redirected to SALOME GUI message console
38   \li Client-server architecture is intialized and used as in any ParaView client
39  */
40 class PVGUI_ProcessModuleHelper : public pqProcessModuleGUIHelper
41 {
42 public:
43   static PVGUI_ProcessModuleHelper* New();
44   vtkTypeRevisionMacro(PVGUI_ProcessModuleHelper, pqProcessModuleGUIHelper);
45   void PrintSelf(ostream& os, vtkIndent indent);
46
47
48   //! Compares the contents of the window with the given reference image, returns true iff they "match" within some tolerance
49   virtual  bool compareView(const QString& ReferenceImage, double Threshold, ostream& Output, const QString& TempDirectory);
50
51   //! Redefined to supress showing a default output window, as the messages are redirected
52   //! to SALOME GUI message console
53   virtual void showOutputWindow();
54
55   //! Stub for main window
56   virtual void showWindow();
57   //! Stub for main window
58   virtual void hideWindow();
59
60 protected:
61   //! Calls the base implementation and then creates a custom output window adaptor
62   virtual int InitializeApplication(int argc, char** argv);
63
64   //! Redefined to prevent QApplication::exec() call
65   virtual int appExec();
66
67   //! Redefined to do nothing at the end of RunGUIStart().
68   //! FinalizeApplication() should be called when the SALOME module
69   //! is destroyed.
70   virtual int postAppExec();
71
72   PVGUI_ProcessModuleHelper();
73   ~PVGUI_ProcessModuleHelper();
74
75   //! Stub for main window, returns a null pointer
76   virtual QWidget* CreateMainWindow();
77
78   //! Called by vtkProcessModule,  but we cannot exit here.
79   virtual void ExitApplication();
80
81 private:
82   PVGUI_ProcessModuleHelper(const PVGUI_ProcessModuleHelper&); // Not implemented.
83   void operator=(const PVGUI_ProcessModuleHelper&); // Not implemented.
84 };
85
86 #endif