0027232: Configuration - fix mblen missing building issue on Android
[occt.git] / src / IVtkDraw / IVtkDraw_Interactor.hxx
... / ...
CommitLineData
1// Created on: 2012-05-28
2//
3// Copyright (c) 2012-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _IVtkDraw_Interactor_HeaderFile
17#define _IVtkDraw_Interactor_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_Macro.hxx>
21#include <MMgt_TShared.hxx>
22
23#ifdef _WIN32
24#include <windows.h>
25#else
26#include <X11/X.h>
27#include <X11/Xlib.h>
28#include <X11/Shell.h>
29#include <X11/Xutil.h>
30#include <tk.h>
31#endif
32
33#include <vtkRenderWindowInteractor.h>
34#include <vtkSmartPointer.h>
35#include <IVtkTools_ShapePicker.hxx>
36#include <IVtkDraw_HighlightAndSelectionPipeline.hxx>
37#include <Aspect_Window.hxx>
38
39class vtkWin32RenderWindowInteractor;
40typedef vtkSmartPointer<IVtkTools_ShapePicker> PSelector;
41
42class IVtkDraw_Interactor : public vtkRenderWindowInteractor
43{
44public:
45 static IVtkDraw_Interactor *New();
46
47 vtkTypeMacro (IVtkDraw_Interactor, vtkRenderWindowInteractor)
48
49 virtual void Initialize();
50 virtual void Enable();
51 virtual void Start() { }
52
53 void SetShapePicker (const PSelector& theSelector);
54 void SetPipelines (const Handle(ShapePipelineMap)& thePipelines);
55 void SetOCCWindow (const Handle(Aspect_Window)& theWindow);
56 const Handle(Aspect_Window)& GetOCCWindow() const;
57
58 //! Process highlighting
59 void MoveTo (Standard_Integer theX, Standard_Integer theY);
60
61 //! Process selection
62 void OnSelection();
63
64 Standard_Boolean IsEnabled() const;
65
66#ifndef _WIN32
67 Display* GetDisplayId() const;
68 Standard_Integer ViewerMainLoop (Standard_Integer theArgNum, const char** theArgs);
69#endif
70
71protected:
72 IVtkDraw_Interactor();
73 ~IVtkDraw_Interactor();
74
75#ifdef _WIN32
76 friend LRESULT CALLBACK WndProc (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
77 friend LRESULT CALLBACK ViewerWindowProc (HWND hwnd,
78 UINT Msg,
79 WPARAM wParam,
80 LPARAM lParam,
81 IVtkDraw_Interactor *theInteractor);
82
83 void OnMouseMove (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
84 void OnRButtonDown (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y, Standard_Integer repeat=0);
85 void OnRButtonUp (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
86 void OnMButtonDown (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y, Standard_Integer repeat=0);
87 void OnMButtonUp (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
88 void OnLButtonDown (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y, Standard_Integer repeat=0);
89 void OnLButtonUp (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
90 void OnSize (HWND wnd, UINT nType, Standard_Integer X, Standard_Integer Y);
91 void OnTimer (HWND wnd, UINT nIDEvent);
92 void OnMouseWheelForward (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
93 void OnMouseWheelBackward (HWND wnd, UINT nFlags, Standard_Integer X, Standard_Integer Y);
94#else
95 static void ProcessEvents (ClientData theData, int);
96 void GetMousePosition (Standard_Integer *theX, Standard_Integer *theY);
97#endif
98
99private:
100 // copying is prohibited
101 IVtkDraw_Interactor (const IVtkDraw_Interactor&);
102 void operator = (const IVtkDraw_Interactor&);
103
104private:
105
106#ifdef _WIN32
107 HWND myWindowId;
108 Standard_Integer myMouseInWindow;
109#else
110 Window myWindowId;
111 Display *myDisplayId;
112 Standard_Boolean myIsLeftButtonPressed;
113#endif
114
115 PSelector mySelector;
116 Handle(ShapePipelineMap) myPipelines;
117 Handle(Aspect_Window) myWindow;
118
119};
120
121#endif