VTK
vtkContextInteractorStyle.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContextInteractorStyle.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef vtkContextInteractorStyle_h
29 #define vtkContextInteractorStyle_h
30 
31 #include "vtkViewsContext2DModule.h" // For export macro
32 #include "vtkInteractorStyle.h"
33 #include "vtkNew.h" // For ivars
34 #include "vtkWeakPointer.h" // For ivars
35 
37 class vtkContextScene;
38 
39 class VTKVIEWSCONTEXT2D_EXPORT vtkContextInteractorStyle : public vtkInteractorStyle
40 {
41 public:
44  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
45 
53  void SetScene(vtkContextScene* scene);
54 
58  vtkContextScene* GetScene();
59 
63  virtual void OnSceneModified();
64 
69  void OnMouseMove() VTK_OVERRIDE;
70 
75  void OnLeftButtonDown() VTK_OVERRIDE;
76 
81  void OnLeftButtonUp() VTK_OVERRIDE;
82 
87  void OnMiddleButtonDown() VTK_OVERRIDE;
88 
93  void OnMiddleButtonUp() VTK_OVERRIDE;
94 
99  void OnRightButtonDown() VTK_OVERRIDE;
100 
105  void OnRightButtonUp() VTK_OVERRIDE;
106 
111  void OnMouseWheelForward() VTK_OVERRIDE;
112 
117  void OnMouseWheelBackward() VTK_OVERRIDE;
118 
123  virtual void OnSelection(unsigned int rect[5]);
124 
128  void OnChar() VTK_OVERRIDE;
129 
133  void OnKeyPress() VTK_OVERRIDE;
134 
138  void OnKeyRelease() VTK_OVERRIDE;
139 
140 protected:
142  ~vtkContextInteractorStyle() VTK_OVERRIDE;
143 
144  static void ProcessSceneEvents(vtkObject* object, unsigned long event,
145  void* clientdata, void* calldata);
146 
147  static void ProcessInteractorEvents(vtkObject* object, unsigned long event,
148  void* clientdata, void* calldata);
149 
150  virtual void RenderNow();
151 
157  void BeginProcessingEvent();
158 
164  void EndProcessingEvent();
165 
167  vtkNew<vtkCallbackCommand> SceneCallbackCommand;
168  vtkNew<vtkCallbackCommand> InteractorCallbackCommand;
169  int ProcessingEvents;
170  vtkMTimeType LastSceneRepaintMTime;
171 
172  int TimerId;
173  bool TimerCallbackInitialized;
174 
175 private:
176  vtkContextInteractorStyle(const vtkContextInteractorStyle&) VTK_DELETE_FUNCTION;
177  void operator=(const vtkContextInteractorStyle&) VTK_DELETE_FUNCTION;
178 
179  void ConstructMouseEvent(vtkContextMouseEvent &event, int button);
180  bool ProcessMousePress(const vtkContextMouseEvent &event);
181 };
182 
183 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
static vtkInteractorStyle * New()
This class must be supplied with a vtkRenderWindowInteractor wrapper or parent.
An interactor for chart views.
supports function callbacks
Provides a 2D scene for vtkContextItem objects.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:39
a weak reference to a vtkObject.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Allocate and hold a VTK object.
Definition: vtkNew.h:67
provide event-driven interface to the rendering window (defines trackball mode)
virtual void OnMouseMove()
Generic event bindings can be overridden in subclasses.