VTK  9.0.2
vtkCocoaRenderWindowInteractor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCocoaRenderWindowInteractor.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 =========================================================================*/
33 #ifndef vtkCocoaRenderWindowInteractor_h
34 #define vtkCocoaRenderWindowInteractor_h
35 
37 #include "vtkRenderingUIModule.h" // For export macro
38 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
39 #ifdef VTK_USE_TDX
40 class vtkTDxMacDevice;
41 #endif
42 
43 class VTKRENDERINGUI_EXPORT vtkCocoaRenderWindowInteractor : public vtkRenderWindowInteractor
44 {
45 public:
50 
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
57  void Initialize() override;
58 
60 
69  void Enable() override;
70  void Disable() override;
72 
78  void TerminateApp() override;
79 
85  void ProcessEvents() override;
86 
88 
94  static void SetClassExitMethod(void (*f)(void*), void* arg);
95  static void SetClassExitMethodArgDelete(void (*f)(void*));
97 
102  void ExitCallback() override;
103 
104  // int GetButtonDown();
105  // void SetButtonDown(int button);
106 
107 protected:
110 
115  void SetTimerDictionary(void* dictionary); // Really an NSMutableDictionary*
117 
119 
124  static void (*ClassExitMethod)(void*);
125  static void (*ClassExitMethodArgDelete)(void*);
126  static void* ClassExitMethodArg;
128 
130 
134  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
135  int InternalDestroyTimer(int platformTimerId) override;
137 
143  void StartEventLoop() override;
144 
146 
150  void SetCocoaManager(void* manager);
153 
154 #ifdef VTK_USE_TDX
155  vtkTDxMacDevice* Device;
156 #endif
157 
158 private:
160  void operator=(const vtkCocoaRenderWindowInteractor&) = delete;
161 
162  // Important: this class cannot contain Objective-C instance
163  // variables for 2 reasons:
164  // 1) C++ files include this header
165  // 2) because of garbage collection
166  // Instead, use the CocoaManager dictionary to keep a collection
167  // of what would otherwise be Objective-C instance variables.
168  void* CocoaManager; // Really an NSMutableDictionary*
169 };
170 
171 #endif
implements Cocoa specific functions required by vtkRenderWindowInteractor.
void StartEventLoop() override
This will start up the event loop and never return.
~vtkCocoaRenderWindowInteractor() override
static void SetClassExitMethod(void(*f)(void *), void *arg)
Methods to set the default exit method for the class.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int InternalDestroyTimer(int platformTimerId) override
void ProcessEvents() override
Run the event loop and return.
void SetCocoaManager(void *manager)
Accessors for the cocoa manager (Really an NSMutableDictionary*).
static vtkCocoaRenderWindowInteractor * New()
Construct object so that light follows camera motion.
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override
Cocoa-specific internal timer methods.
void Enable() override
Enable/Disable interactions.
void Initialize() override
Initialize the even handler.
void TerminateApp() override
Cocoa specific application terminate, calls ClassExitMethod then calls PostQuitMessage(0) to terminat...
void ExitCallback() override
These methods correspond to the Exit, User and Pick callbacks.
void SetTimerDictionary(void *dictionary)
Accessors for the Cocoa member variables.
static void SetClassExitMethodArgDelete(void(*f)(void *))
a simple class to control print indentation
Definition: vtkIndent.h:34
platform-independent render window interaction including picking and frame rate control.