Salome HOME
Merge branch 'Dev_0.6' of newgeom:newgeom into Dev_0.6
[modules/shaper.git] / src / ModuleBase / ModuleBase_IViewer.h
1 #ifndef ModuleBase_IViewer_H
2 #define ModuleBase_IViewer_H
3
4 #include "ModuleBase.h"
5 #include <QObject>
6 #include <AIS_InteractiveContext.hxx>
7 #include <V3d_View.hxx>
8
9 class QMouseEvent;
10 class QKeyEvent;
11 class QContextMenuEvent;
12 class ModuleBase_IViewWindow;
13
14 /**
15  * A Base object for definition of connector object to
16  * Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
17  */
18 class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject
19 {
20 Q_OBJECT
21  public:
22   ModuleBase_IViewer(QObject* theParent)
23       : QObject(theParent)
24   {
25   }
26
27   //! Returns AIS_InteractiveContext from current OCCViewer
28   virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
29
30   //! Retrurns V3d_Vioewer from current viewer
31   virtual Handle(V3d_Viewer) v3dViewer() const = 0;
32
33   //! Returns Vsd_View object from currently active view window
34   virtual Handle(V3d_View) activeView() const = 0;
35
36   //! Enable or disable selection in the viewer
37   virtual void enableSelection(bool isEnabled) = 0;
38
39   //! Returns true if selection is enabled
40   virtual bool isSelectionEnabled() const = 0;
41
42   //! Enable or disable multiselection in the viewer
43   virtual void enableMultiselection(bool isEnable) = 0;
44
45   //! Returns true if multiselection is enabled
46   virtual bool isMultiSelectionEnabled() const = 0;
47
48   //! Perfroms the fit all for the active view
49   virtual void fitAll() = 0;
50
51   //! Sets the view projection
52   /// \param theX the X projection value
53   /// \param theY the Y projection value
54   /// \param theZ the Z projection value
55   virtual void setViewProjection(double theX, double theY, double theZ) = 0;
56
57   /// Add selection filter to the viewer
58   virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
59
60   /// Remove selection filter from the viewer
61   virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
62
63   /// Remove all selection filters from the viewer
64   virtual void clearSelectionFilters() = 0;
65
66 signals:
67   void lastViewClosed();
68   void tryCloseView(ModuleBase_IViewWindow* theWnd);
69   void deleteView(ModuleBase_IViewWindow* theWnd);
70   void viewCreated(ModuleBase_IViewWindow* theWnd);
71   void activated(ModuleBase_IViewWindow* theWnd);
72
73   void mousePress(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
74   void mouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
75   void mouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
76   void mouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
77
78   void keyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
79   void keyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
80
81   void selectionChanged();
82   void contextMenuRequested(QContextMenuEvent*);
83 };
84
85 #endif