Salome HOME
Merge branch 'master' into Dev_1.1.0
[modules/shaper.git] / src / ModuleBase / ModuleBase_IViewer.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #ifndef ModuleBase_IViewer_H
4 #define ModuleBase_IViewer_H
5
6 #include "ModuleBase.h"
7 #include <QObject>
8 #include <AIS_InteractiveContext.hxx>
9 #include <V3d_View.hxx>
10
11 class QMouseEvent;
12 class QKeyEvent;
13 class QContextMenuEvent;
14 class ModuleBase_IViewWindow;
15
16 /**
17  * \ingroup GUI
18  * A Base object for definition of connector object to
19  * Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
20  */
21 class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject
22 {
23 Q_OBJECT
24  public:
25    /// Constructor
26    /// \param theParent a parent object
27   ModuleBase_IViewer(QObject* theParent)
28       : QObject(theParent)
29   {
30   }
31
32   //! Returns AIS_InteractiveContext from current OCCViewer
33   virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
34
35   //! Retrurns V3d_Vioewer from current viewer
36   virtual Handle(V3d_Viewer) v3dViewer() const = 0;
37
38   //! Returns Vsd_View object from currently active view window
39   virtual Handle(V3d_View) activeView() const = 0;
40
41   //! Enable or disable selection in the viewer
42   //! \param isEnabled is enable or disable flag
43   virtual void enableSelection(bool isEnabled) = 0;
44
45   //! Returns true if selection is enabled
46   virtual bool isSelectionEnabled() const = 0;
47
48   //! Enable or disable multiselection in the viewer
49   //! \param isEnable is enable or disable flag
50   virtual void enableMultiselection(bool isEnable) = 0;
51
52   //! Returns true if multiselection is enabled
53   virtual bool isMultiSelectionEnabled() const = 0;
54
55   //! Perfroms the fit all for the active view
56   virtual void fitAll() = 0;
57
58   //! Sets the view projection
59   /// \param theX the X projection value
60   /// \param theY the Y projection value
61   /// \param theZ the Z projection value
62   virtual void setViewProjection(double theX, double theY, double theZ) = 0;
63
64   /// Add selection filter to the viewer
65   /// \param theFilter a selection filter
66   virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
67
68   /// Remove selection filter from the viewer
69   /// \param theFilter a selection filter
70   virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
71
72   /// Remove all selection filters from the viewer
73   virtual void clearSelectionFilters() = 0;
74
75   /// Update current viewer
76   virtual void update() = 0;
77
78   /// Method returns True if the viewer can process editing objects 
79   /// by mouse drugging. If this is impossible thet it has to return False.
80   virtual bool canDragByMouse() const { return true; }
81
82 signals:
83   /// Signal emited when last view window is closed
84   void lastViewClosed();
85
86   /// Signal emited before view window is closed
87   void tryCloseView(ModuleBase_IViewWindow* theWnd);
88
89   /// Signal emited on delete view window
90   void deleteView(ModuleBase_IViewWindow* theWnd);
91
92   /// Signal emited on creation of view window
93   void viewCreated(ModuleBase_IViewWindow* theWnd);
94
95   /// Signal emited on key release
96   void activated(ModuleBase_IViewWindow* theWnd);
97
98   /// Signal emited on mouse press
99   void mousePress(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
100
101   /// Signal emited on mouse release
102   void mouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
103
104   /// Signal emited on mouse double click
105   void mouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
106
107   /// Signal emited on mouse move
108   void mouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
109
110   /// Signal emited on key press
111   void keyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
112
113   /// Signal emited on key release
114   void keyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
115
116   /// Signal emited on selection changed
117   void selectionChanged();
118
119   /// Signal emited on selection changed
120   void contextMenuRequested(QContextMenuEvent*);
121 };
122
123 #endif