Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / VTKViewer / VTKViewer_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/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef VTKVIEWER_VIEWMODEL_H
20 #define VTKVIEWER_VIEWMODEL_H
21
22 #include "VTKViewer.h"
23 #include "SUIT_ViewModel.h"
24
25 #include <qcolor.h>
26
27 class SUIT_ViewWindow;
28 class SUIT_Desktop;
29
30 class VTKVIEWER_EXPORT VTKViewer_Viewer: public SUIT_ViewModel
31 {
32   Q_OBJECT
33
34 public:
35   /*!Initialize type of viewer.*/
36   static QString Type() { return "VTKViewer"; }
37
38   VTKViewer_Viewer();
39   virtual ~VTKViewer_Viewer();
40
41   virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
42
43   virtual void             setViewManager(SUIT_ViewManager* theViewManager);
44   virtual void             contextMenuPopup( QPopupMenu* );
45   /*!Gets type of viewer.*/
46   virtual QString          getType() const { return Type(); }
47
48 public:
49   void enableSelection(bool isEnabled);
50   /*!Checks: is selection enabled*/
51   bool isSelectionEnabled() const { return mySelectionEnabled; }
52
53   void enableMultiselection(bool isEnable);
54   /*!Checks: is multi selection enabled*/
55   bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
56
57   int  getSelectionCount() const;
58
59   QColor backgroundColor() const;
60   void   setBackgroundColor( const QColor& );
61
62 signals:
63   void selectionChanged();
64
65 protected slots:
66   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
67   void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
68   void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
69
70   void onDumpView();
71   void onShowToolbar();
72   void onChangeBgColor();
73
74 private:
75   QColor myBgColor;
76   bool   mySelectionEnabled;
77   bool   myMultiSelectionEnabled;
78 };
79
80 #endif