VTK  9.3.20240416
vtkContextInteractorStyle.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
16 #ifndef vtkContextInteractorStyle_h
17 #define vtkContextInteractorStyle_h
18 
19 #include "vtkInteractorStyle.h"
20 #include "vtkNew.h" // For ivars
21 #include "vtkViewsContext2DModule.h" // For export macro
22 #include "vtkWeakPointer.h" // For ivars
23 
24 VTK_ABI_NAMESPACE_BEGIN
26 class vtkContextScene;
27 
28 class VTKVIEWSCONTEXT2D_EXPORT vtkContextInteractorStyle : public vtkInteractorStyle
29 {
30 public:
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
42  void SetScene(vtkContextScene* scene);
43 
48 
52  virtual void OnSceneModified();
53 
58  void OnMouseMove() override;
59 
64  void OnLeftButtonDown() override;
65 
70  void OnLeftButtonUp() override;
71 
76  void OnLeftButtonDoubleClick() override;
77 
82  void OnMiddleButtonDown() override;
83 
88  void OnMiddleButtonUp() override;
89 
94  void OnMiddleButtonDoubleClick() override;
95 
100  void OnRightButtonDown() override;
101 
106  void OnRightButtonUp() override;
107 
112  void OnRightButtonDoubleClick() override;
113 
118  void OnMouseWheelForward() override;
119 
124  void OnMouseWheelBackward() override;
125 
130  virtual void OnSelection(unsigned int rect[5]);
131 
135  void OnChar() override;
136 
140  void OnKeyPress() override;
141 
145  void OnKeyRelease() override;
146 
147 protected:
150 
151  static void ProcessSceneEvents(
152  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
153 
155  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
156 
157  virtual void RenderNow();
158 
165 
172 
178 
181 
182 private:
184  void operator=(const vtkContextInteractorStyle&) = delete;
185 
186  void ConstructMouseEvent(vtkContextMouseEvent& event, int button);
187  bool ProcessMousePress(const vtkContextMouseEvent& event);
188 };
189 
190 VTK_ABI_NAMESPACE_END
191 #endif
An interactor for chart views.
void OnLeftButtonDown() override
Called when the user clicks the mouse left button.
void OnMiddleButtonDown() override
Called when the user clicks the mouse middle button.
void OnRightButtonUp() override
Called when the user releases the mouse right button.
void OnChar() override
Handle key presses.
void OnMouseWheelBackward() override
Called when the user moves the mouse wheel backward.
void EndProcessingEvent()
Inform the interactor style that an event is finished to be processed.
vtkNew< vtkCallbackCommand > InteractorCallbackCommand
virtual void OnSceneModified()
Called when the scene is modified.
void OnLeftButtonDoubleClick() override
Called when the user double-clicks the mouse left button.
static vtkContextInteractorStyle * New()
void SetScene(vtkContextScene *scene)
Set the scene to forward user events to.
vtkNew< vtkCallbackCommand > SceneCallbackCommand
~vtkContextInteractorStyle() override
static void ProcessInteractorEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void OnKeyRelease() override
Called when the user releases a key.
static void ProcessSceneEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
virtual void OnSelection(unsigned int rect[5])
Place holder for future implementation.
virtual void RenderNow()
void OnRightButtonDoubleClick() override
Called when the user double-clicks the mouse right button.
vtkWeakPointer< vtkContextScene > Scene
void OnRightButtonDown() override
Called when the user clicks the mouse right button.
void OnMiddleButtonUp() override
Called when the user releases the mouse middle button.
void OnMouseMove() override
Called when the user moves the mouse Default behavior forwards the event to the observed scene.
void OnMiddleButtonDoubleClick() override
Called when the user double-clicks the mouse middle button.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void OnMouseWheelForward() override
Called when the user moves the mouse wheel forward.
vtkContextScene * GetScene()
Return the observed scene.
void OnKeyPress() override
Called when the user presses a key.
void BeginProcessingEvent()
Inform the interactor style that an event is being processed.
void OnLeftButtonUp() override
Called when the user releases the mouse left button.
data structure to represent mouse events.
Provides a 2D scene for vtkContextItem objects.
a simple class to control print indentation
Definition: vtkIndent.h:108
provide event-driven interface to the rendering window (defines trackball mode)
abstract base class for most VTK objects
Definition: vtkObject.h:162
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270