VTK  9.7.1
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
28 #ifdef VTK_USE_TDX
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkTDxMacDevice;
31 VTK_ABI_NAMESPACE_END
32 #endif
33 
34 VTK_ABI_NAMESPACE_BEGIN
37 {
38 public:
43 
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  void Initialize() override;
51 
53 
62  void Enable() override;
63  void Disable() override;
65 
71  void TerminateApp() override;
72 
77  void ProcessEvents() override;
78 
80 
86  static void SetClassExitMethod(void (*f)(void*), void* arg);
87  static void SetClassExitMethodArgDelete(void (*f)(void*));
89 
94  void ExitCallback() override;
95 
96  // int GetButtonDown();
97  // void SetButtonDown(int button);
98 
99 protected:
101  ~vtkCocoaRenderWindowInteractor() override;
102 
107  void SetTimerDictionary(void* dictionary); // Really an NSMutableDictionary*
108  void* GetTimerDictionary();
109 
111 
116  static void (*ClassExitMethod)(void*);
117  static void (*ClassExitMethodArgDelete)(void*);
118  static void* ClassExitMethodArg;
120 
122 
126  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
127  int InternalDestroyTimer(int platformTimerId) override;
129 
135  void StartEventLoop() override;
136 
138 
142  void SetCocoaManager(void* manager);
143  void* GetCocoaManager();
145 
146 #ifdef VTK_USE_TDX
147  vtkTDxMacDevice* Device;
148 #endif
149 
150 private:
152  void operator=(const vtkCocoaRenderWindowInteractor&) = delete;
153 
154  // Important: this class cannot contain Objective-C instance
155  // variables for 2 reasons:
156  // 1) C++ files include this header
157  // 2) because of garbage collection
158  // Instead, use the CocoaManager dictionary to keep a collection
159  // of what would otherwise be Objective-C instance variables.
160  void* CocoaManager; // Really an NSMutableDictionary*
161 };
162 
163 VTK_ABI_NAMESPACE_END
164 #endif
virtual void Enable()
Enable/Disable interactions.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
static vtkRenderWindowInteractor * New()
implements Cocoa specific functions required by vtkRenderWindowInteractor.
platform-independent render window interaction including picking and frame rate control.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
virtual void ProcessEvents()
Process all user-interaction, timer events and return.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void TerminateApp()
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
#define VTK_MARSHALAUTO