1 // Created on: 2012-05-28
3 // Copyright (c) 2012-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _IVtkDraw_Interactor_HeaderFile
17 #define _IVtkDraw_Interactor_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Macro.hxx>
21 #include <MMgt_TShared.hxx>
28 #include <X11/Shell.h>
29 #include <X11/Xutil.h>
33 #include <vtkRenderWindowInteractor.h>
34 #include <vtkSmartPointer.h>
35 #include <IVtkTools_ShapePicker.hxx>
36 #include <IVtkDraw_HighlightAndSelectionPipeline.hxx>
37 #include <Aspect_Window.hxx>
39 class vtkWin32RenderWindowInteractor;
40 typedef vtkSmartPointer<IVtkTools_ShapePicker> PSelector;
42 class IVtkDraw_Interactor : public vtkRenderWindowInteractor
45 static IVtkDraw_Interactor *New();
46 vtkTypeMacro (IVtkDraw_Interactor, vtkRenderWindowInteractor);
48 virtual void Initialize();
49 virtual void Enable();
50 virtual void Start() { }
52 void SetShapePicker (const PSelector& theSelector);
53 void SetPipelines (const Handle(ShapePipelineMap)& thePipelines);
54 void SetOCCWindow (const Handle(Aspect_Window)& theWindow);
55 const Handle(Aspect_Window)& GetOCCWindow() const;
57 //! Process highlighting
58 void MoveTo (Standard_Integer theX, Standard_Integer theY);
63 Standard_Boolean IsEnabled() const;
66 Display* GetDisplayId() const;
67 Standard_Integer ViewerMainLoop (Standard_Integer theArgNum, const char** theArgs);
71 IVtkDraw_Interactor();
72 IVtkDraw_Interactor (const IVtkDraw_Interactor& );
73 ~IVtkDraw_Interactor();
77 friend LRESULT CALLBACK WndProc (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
78 friend LRESULT CALLBACK ViewerWindowProc (HWND hwnd,
82 IVtkDraw_Interactor *theInteractor);
84 void OnMouseMove (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
85 void OnRButtonDown (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y, Standard_Integer repeat=0);
86 void OnRButtonUp (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
87 void OnMButtonDown (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y, Standard_Integer repeat=0);
88 void OnMButtonUp (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
89 void OnLButtonDown (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y, Standard_Integer repeat=0);
90 void OnLButtonUp (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
91 void OnSize (HWND wnd, UINT nType, Standard_Integer X, Standard_Integer Y);
92 void OnTimer (HWND wnd, UINT nIDEvent);
93 void OnMouseWheelForward (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
94 void OnMouseWheelBackward (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
96 static void ProcessEvents (ClientData theData, int);
97 void GetMousePosition (Standard_Integer *theX, Standard_Integer *theY);
105 Standard_Integer myMouseInWindow;
108 Display *myDisplayId;
109 Standard_Boolean myIsLeftButtonPressed;
112 PSelector mySelector;
113 Handle(ShapePipelineMap) myPipelines;
114 Handle(Aspect_Window) myWindow;