VTK  9.3.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 #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*
106  void* GetTimerDictionary();
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);
141  void* GetCocoaManager();
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
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...