1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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, or (at your option) any later version.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef OCCVIEWER_VIEWPORTINPUTFILTER_H
24 #define OCCVIEWER_VIEWPORTINPUTFILTER_H
28 class OCCViewer_ViewManager;
29 class OCCViewer_ViewPort3d;
30 class OCCViewer_Viewer;
31 class SUIT_ViewWindow;
36 \class OCCViewer_ViewportInputFilter.
37 \brief The user input filter of OCC viewports. The class can be used
38 to introduce custom interactive operations in OCC viewer,
39 e.g. manipulating IO. The filter receives events in priority
40 to the viewport itself and can bypass some events if it provides
43 This class is abstract and required implementation of custom reaction
44 on hooked viewport events. The role of the code behind this class
45 is to properly embed the event filter into OCC viewer's structure.
47 class OCCViewer_ViewportInputFilter : public QObject
52 OCCViewer_ViewportInputFilter( OCCViewer_ViewManager*, QObject* );
53 ~OCCViewer_ViewportInputFilter();
56 virtual void setEnabled( const bool );
59 virtual bool mouseMove( QMouseEvent*, OCCViewer_ViewPort3d* ) = 0;
60 virtual bool mousePress( QMouseEvent*, OCCViewer_ViewPort3d* ) = 0;
61 virtual bool mouseRelease( QMouseEvent*, OCCViewer_ViewPort3d* ) = 0;
62 virtual bool mouseDoubleClick( QMouseEvent*, OCCViewer_ViewPort3d* ) = 0;
63 virtual bool keyPress( QKeyEvent*, OCCViewer_ViewPort3d* ) = 0;
64 virtual bool keyRelease( QKeyEvent*, OCCViewer_ViewPort3d* ) = 0;
67 void connectView( SUIT_ViewWindow* );
68 void disconnectView( SUIT_ViewWindow* );
71 bool eventFilter( QObject*, QEvent* );
74 void onViewCreated( SUIT_ViewWindow* );
75 void onViewRemoved( SUIT_ViewWindow* );
78 OCCViewer_ViewManager* myVM;
79 OCCViewer_Viewer* myViewer;