VTK  9.3.0
vtkCocoaRenderWindowInteractor.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
21 #ifndef vtkCocoaRenderWindowInteractor_h
22 #define vtkCocoaRenderWindowInteractor_h
23 
25 #include "vtkRenderingUIModule.h" // For export macro
26 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
27 #ifdef VTK_USE_TDX
28 VTK_ABI_NAMESPACE_BEGIN
29 class vtkTDxMacDevice;
30 VTK_ABI_NAMESPACE_END
31 #endif
32 
33 VTK_ABI_NAMESPACE_BEGIN
34 class VTKRENDERINGUI_EXPORT vtkCocoaRenderWindowInteractor : public vtkRenderWindowInteractor
35 {
36 public:
41 
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
48  void Initialize() override;
49 
51 
60  void Enable() override;
61  void Disable() override;
63 
69  void TerminateApp() override;
70 
75  void ProcessEvents() override;
76 
78 
84  static void SetClassExitMethod(void (*f)(void*), void* arg);
85  static void SetClassExitMethodArgDelete(void (*f)(void*));
87 
92  void ExitCallback() override;
93 
94  // int GetButtonDown();
95  // void SetButtonDown(int button);
96 
97 protected:
100 
105  void SetTimerDictionary(void* dictionary); // Really an NSMutableDictionary*
107 
109 
114  static void (*ClassExitMethod)(void*);
115  static void (*ClassExitMethodArgDelete)(void*);
116  static void* ClassExitMethodArg;
118 
120 
124  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
125  int InternalDestroyTimer(int platformTimerId) override;
127 
133  void StartEventLoop() override;
134 
136 
140  void SetCocoaManager(void* manager);
143 
144 #ifdef VTK_USE_TDX
145  vtkTDxMacDevice* Device;
146 #endif
147 
148 private:
150  void operator=(const vtkCocoaRenderWindowInteractor&) = delete;
151 
152  // Important: this class cannot contain Objective-C instance
153  // variables for 2 reasons:
154  // 1) C++ files include this header
155  // 2) because of garbage collection
156  // Instead, use the CocoaManager dictionary to keep a collection
157  // of what would otherwise be Objective-C instance variables.
158  void* CocoaManager; // Really an NSMutableDictionary*
159 };
160 
161 VTK_ABI_NAMESPACE_END
162 #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
Cocoa-specific internal timer methods.
void ProcessEvents() override
Process all user-interaction, timer events 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 Disable() override
Enable/Disable interactions.
void ExitCallback() override
These methods correspond to the Exit, User and Pick callbacks.
void * GetCocoaManager()
Accessors for the cocoa manager (Really an NSMutableDictionary*).
void SetTimerDictionary(void *dictionary)
Accessors for the Cocoa member variables.
static void SetClassExitMethodArgDelete(void(*f)(void *))
Methods to set the default exit method for the class.
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...
a simple class to control print indentation
Definition: vtkIndent.h:29
platform-independent render window interaction including picking and frame rate control.