Salome HOME
(Issue #31) Proxy viewer created in order to provide uniform dispatching of events...
[modules/shaper.git] / src / XGUI / XGUI_ViewerProxy.h
1 #ifndef XGUI_VIEWERPROXY_H
2 #define XGUI_VIEWERPROXY_H
3
4 #include "XGUI.h"
5 #include "XGUI_SalomeViewer.h"
6
7 class XGUI_Workshop;
8 class XGUI_ViewWindow;
9
10 /**
11 * Proxy class which repersents or XGUI_Viewer or Salome Viewer
12 * dependently on current launching environment.
13 * It is reccomennded to use this class in operation for accessing to viewer 
14 * functionality instead of direct access to a viewer
15 */
16 class XGUI_ViewerProxy: public XGUI_SalomeViewer
17 {
18   Q_OBJECT
19 public:
20   XGUI_ViewerProxy(XGUI_Workshop* theParent);
21
22   //! Returns AIS_InteractiveContext from current OCCViewer
23   virtual Handle(AIS_InteractiveContext) AISContext() const;
24
25   //! Retrurns V3d_Vioewer from current viewer
26   virtual Handle(V3d_Viewer) v3dViewer() const;
27
28   //! Returns Vsd_View object from currently active view window
29   virtual Handle(V3d_View) activeView() const;
30
31   void connectToViewer();
32
33 private slots:
34   void onMousePress(XGUI_ViewWindow*, QMouseEvent*);
35   void onMouseRelease(XGUI_ViewWindow*, QMouseEvent*);
36   void onMouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*);
37   void onMouseMove(XGUI_ViewWindow*, QMouseEvent*);
38   void onKeyPress(XGUI_ViewWindow*, QKeyEvent*);
39   void onKeyRelease(XGUI_ViewWindow*, QKeyEvent*);
40
41 private:
42   XGUI_Workshop* myWorkshop;
43 };
44
45 #endif