]> SALOME platform Git repositories - modules/gui.git/blob - src/SVTK/SVTK_ViewModel.h
Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/gui.git] / src / SVTK / SVTK_ViewModel.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/
18 //
19 #ifndef SVTK_VIEWMODEL_H
20 #define SVTK_VIEWMODEL_H
21
22 #include "SVTK.h"
23 #include "SUIT_ViewModel.h"
24 #include "SVTK_ViewModelBase.h"
25
26 #include "SALOME_Prs.h"
27 #include "SALOME_InteractiveObject.hxx"
28
29 #include <qcolor.h>
30
31 class SVTK_ViewWindow;
32
33 //! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View 
34 class SVTK_EXPORT SVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View 
35 {
36   Q_OBJECT;
37
38 public:
39   typedef SVTK_ViewWindow TViewWindow;
40   
41   //! Define string representation of the viewer type
42   static QString Type() { return "VTKViewer"; }
43
44   SVTK_Viewer();
45   virtual ~SVTK_Viewer();
46
47   //! See #SUIT_ViewModel::createView
48   virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
49
50   //! See #SUIT_ViewModel::createView
51   virtual void setViewManager(SUIT_ViewManager* theViewManager);
52
53   //! See #SUIT_ViewModel::contextMenuPopup
54   virtual void contextMenuPopup( QPopupMenu* );
55
56   //! See #SUIT_ViewModel::getType
57   virtual QString getType() const { return Type(); }
58
59   //! Get background color of the viewer
60   QColor backgroundColor() const;
61
62   //! Set background color to the viewer
63   void setBackgroundColor( const QColor& );
64
65   //! Get size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
66   int trihedronSize() const;
67
68   //! Shows if the size of trihedron relative (see #SVTK_Renderer::SetTrihedronSize)
69   bool trihedronRelative() const;
70
71   //! Set size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
72   void setTrihedronSize( const int, const bool = true );
73
74 public:
75   void enableSelection(bool isEnabled);
76   bool isSelectionEnabled() const { return mySelectionEnabled; }
77
78   void enableMultiselection(bool isEnable);
79   bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
80
81   int  getSelectionCount() const;
82
83   /* Reimplemented from SALOME_View */
84
85   //! See #SALOME_View::Display( const SALOME_Prs* )
86   void Display( const SALOME_VTKPrs* ); 
87
88   //! See #SALOME_View::Erase( const SALOME_VTKPrs*, const bool = false )
89   void Erase( const SALOME_VTKPrs*, const bool = false );
90
91   //! See #SALOME_View::EraseAll( const bool = false )
92   void EraseAll( const bool = false );
93
94   //! See #SALOME_View::CreatePrs( const char* entry = 0 )
95   SALOME_Prs* CreatePrs( const char* entry = 0 );
96
97   //! See #SALOME_View::BeforeDisplay( SALOME_Displayer* d )
98   virtual void BeforeDisplay( SALOME_Displayer* d );
99
100   //! See #SALOME_View::AfterDisplay( SALOME_Displayer* d )
101   virtual void AfterDisplay( SALOME_Displayer* d );
102
103   //! See #SALOME_View::isVisible( const Handle(SALOME_InteractiveObject)& )
104   virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
105
106   //! See #SALOME_View::Repaint()
107   virtual void Repaint();
108
109 protected slots:
110   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
111   void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
112   void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
113
114   void onDumpView();
115   void onShowToolbar();
116   void onChangeBgColor();
117
118 private:
119   QColor myBgColor;
120   int    myTrihedronSize;
121   bool   myTrihedronRelative;
122   bool   mySelectionEnabled;
123   bool   myMultiSelectionEnabled;
124 };
125
126 #endif