VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 =========================================================================*/
27 #ifndef __vtkContextInteractorStyle_h
28 #define __vtkContextInteractorStyle_h
29 
30 #include "vtkViewsContext2DModule.h" // For export macro
31 #include "vtkInteractorStyle.h"
32 #include "vtkNew.h" // For ivars
33 #include "vtkWeakPointer.h" // For ivars
34 
35 class vtkContextMouseEvent;
36 class vtkContextScene;
37 
38 class VTKVIEWSCONTEXT2D_EXPORT vtkContextInteractorStyle : public vtkInteractorStyle
39 {
40 public:
41  static vtkContextInteractorStyle *New();
42  vtkTypeMacro(vtkContextInteractorStyle, vtkInteractorStyle);
43  void PrintSelf(ostream& os, vtkIndent indent);
44 
49  void SetScene(vtkContextScene* scene);
50 
52  vtkContextScene* GetScene();
53 
55  virtual void OnSceneModified();
56 
59  virtual void OnMouseMove();
60 
63  virtual void OnLeftButtonDown();
64 
67  virtual void OnLeftButtonUp();
68 
71  virtual void OnMiddleButtonDown();
72 
75  virtual void OnMiddleButtonUp();
76 
79  virtual void OnRightButtonDown();
80 
83  virtual void OnRightButtonUp();
84 
87  virtual void OnMouseWheelForward();
88 
91  virtual void OnMouseWheelBackward();
92 
95  virtual void OnSelection(unsigned int rect[5]);
96 
98  virtual void OnChar();
99 
101  virtual void OnKeyPress();
102 
104  virtual void OnKeyRelease();
105 
106 protected:
109 
110  static void ProcessSceneEvents(vtkObject* object, unsigned long event,
111  void* clientdata, void* calldata);
112 
113  static void ProcessInteractorEvents(vtkObject* object, unsigned long event,
114  void* clientdata, void* calldata);
115 
116  virtual void RenderNow();
117 
121  void BeginProcessingEvent();
122 
126  void EndProcessingEvent();
127 
128  vtkWeakPointer<vtkContextScene> Scene;
129  vtkNew<vtkCallbackCommand> SceneCallbackCommand;
130  vtkNew<vtkCallbackCommand> InteractorCallbackCommand;
132  unsigned long int LastSceneRepaintMTime;
133 
134  unsigned long int TimerId;
136 
137 private:
138  vtkContextInteractorStyle(const vtkContextInteractorStyle&); // Not implemented
139  void operator=(const vtkContextInteractorStyle&); // Not implemented
140 
141  void ConstructMouseEvent(vtkContextMouseEvent &event, int button);
142  bool ProcessMousePress(const vtkContextMouseEvent &event);
143 };
144 
145 #endif
vtkNew< vtkCallbackCommand > SceneCallbackCommand
An interactor for chart views It observes the user events (mouse events) and propagates them to the s...
vtkNew< vtkCallbackCommand > InteractorCallbackCommand
vtkWeakPointer< vtkContextScene > Scene