VTK  9.7.1
vtkWindow.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
17 #ifndef vtkWindow_h
18 #define vtkWindow_h
19 
20 #include "vtkCommonCoreModule.h" // For export macro
21 #include "vtkObject.h"
22 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkImageData;
27 
28 #define VTK_CURSOR_DEFAULT 0
29 #define VTK_CURSOR_ARROW 1
30 #define VTK_CURSOR_SIZENE 2
31 #define VTK_CURSOR_SIZENW 3
32 #define VTK_CURSOR_SIZESW 4
33 #define VTK_CURSOR_SIZESE 5
34 #define VTK_CURSOR_SIZENS 6
35 #define VTK_CURSOR_SIZEWE 7
36 #define VTK_CURSOR_SIZEALL 8
37 #define VTK_CURSOR_HAND 9
38 #define VTK_CURSOR_CROSSHAIR 10
39 #define VTK_CURSOR_CUSTOM 11
40 
41 class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
42 {
43 public:
44  vtkTypeMacro(vtkWindow, vtkObject);
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
52  virtual void SetDisplayId(void*) {}
53  virtual void SetWindowId(void*) {}
54  virtual void SetParentId(void*) {}
55  virtual void* GetGenericDisplayId() { return nullptr; }
56  virtual void* GetGenericWindowId() { return nullptr; }
57  virtual void* GetGenericParentId() { return nullptr; }
58  virtual void* GetGenericContext() { return nullptr; }
59  virtual void* GetGenericDrawable() { return nullptr; }
60  virtual void SetWindowInfo(const char*) {}
61  virtual void SetParentInfo(const char*) {}
62  virtual bool EnsureDisplay() { return true; }
63 
65 
67 
71  virtual int* GetPosition() VTK_SIZEHINT(2);
72 
78  virtual void SetPosition(int x, int y);
79  virtual void SetPosition(int a[2]);
81 
83 
87  virtual int* GetSize() VTK_SIZEHINT(2);
88 
97  virtual void SetSize(int width, int height);
98  virtual void SetSize(int a[2]);
100 
105  int* GetActualSize() VTK_SIZEHINT(2);
106 
110  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
111 
113 
116  vtkGetMacro(Mapped, vtkTypeBool);
118 
120 
123  vtkGetMacro(ShowWindow, bool);
124  vtkSetMacro(ShowWindow, bool);
125  vtkBooleanMacro(ShowWindow, bool);
127 
129 
134  vtkSetMacro(UseOffScreenBuffers, bool);
135  vtkGetMacro(UseOffScreenBuffers, bool);
136  vtkBooleanMacro(UseOffScreenBuffers, bool);
138 
140 
146  vtkSetMacro(Erase, vtkTypeBool);
147  vtkGetMacro(Erase, vtkTypeBool);
148  vtkBooleanMacro(Erase, vtkTypeBool);
150 
152 
155  vtkSetMacro(DoubleBuffer, vtkTypeBool);
156  vtkGetMacro(DoubleBuffer, vtkTypeBool);
157  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
159 
161 
164  vtkGetStringMacro(WindowName);
165  vtkSetStringMacro(WindowName);
167 
172  virtual void SetIcon(vtkImageData*) {}
173 
179  virtual void Render() {}
180 
187 
189 
201  virtual unsigned char* GetPixelData(
202  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
203  {
204  return nullptr;
205  }
206  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
207  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
208  {
209  return 0;
210  }
212 
214 
219  vtkGetMacro(DPI, int);
220  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
222 
229  virtual bool DetectDPI() { return false; }
230 
232 
236  void SetOffScreenRendering(vtkTypeBool val)
237  {
238  this->SetShowWindow(val == 0);
239  this->SetUseOffScreenBuffers(val != 0);
240  }
241  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
243 
249  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
250 
255  virtual void MakeCurrent() {}
256 
261  virtual void ReleaseCurrent() {}
262 
264 
270  vtkSetVector2Macro(TileScale, int);
271  vtkGetVector2Macro(TileScale, int);
272  void SetTileScale(int s) { this->SetTileScale(s, s); }
273  vtkSetVector4Macro(TileViewport, double);
274  vtkGetVector4Macro(TileViewport, double);
276 
278 
283  vtkSetMacro(Borders, vtkTypeBool);
284  vtkGetMacro(Borders, vtkTypeBool);
285  vtkBooleanMacro(Borders, vtkTypeBool);
287 
289 
295  virtual void HideCursor() {}
296  virtual void ShowCursor() {}
297  virtual void SetCursorPosition(int, int) {}
299 
301 
304  vtkSetMacro(CurrentCursor, int);
305  vtkGetMacro(CurrentCursor, int);
307 
309 
313  vtkSetFilePathMacro(CursorFileName);
314  vtkGetFilePathMacro(CursorFileName);
316 
317 protected:
318  vtkWindow();
319  ~vtkWindow() override;
320 
321  char* WindowName;
322  int Size[2];
323  int Position[2];
329  int DPI;
330  vtkTypeBool Borders = true;
331  int CurrentCursor = VTK_CURSOR_DEFAULT;
332  char* CursorFileName = nullptr;
333 
334  double TileViewport[4];
335  int TileSize[2];
336  int TileScale[2];
337 
338 private:
339  vtkWindow(const vtkWindow&) = delete;
340  void operator=(const vtkWindow&) = delete;
341 };
342 
343 VTK_ABI_NAMESPACE_END
344 #endif
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition: vtkWindow.h:172
virtual void SetCursorPosition(int, int)
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
Definition: vtkWindow.h:297
vtkTypeBool Mapped
Definition: vtkWindow.h:324
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:52
char * WindowName
Definition: vtkWindow.h:321
virtual void HideCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
Definition: vtkWindow.h:295
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:201
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition: vtkWindow.h:272
#define VTK_INT_MAX
Definition: vtkType.h:192
#define VTK_UNBLOCKTHREADS
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:57
virtual void SetParentInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:61
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:54
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:59
virtual int GetPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:206
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
bool ShowWindow
Definition: vtkWindow.h:325
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:62
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:255
#define VTK_SIZEHINT(...)
dynamic, self-adjusting array of unsigned char
#define VTK_MARSHALEXCLUDE(reason)
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:56
virtual void ReleaseCurrent()
Release the current context.
Definition: vtkWindow.h:261
#define VTK_CURSOR_DEFAULT
Definition: vtkWindow.h:28
vtkTypeBool Erase
Definition: vtkWindow.h:327
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition: vtkWindow.h:179
virtual void * GetGenericDisplayId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:55
virtual void ShowCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
Definition: vtkWindow.h:296
#define VTK_MARSHALAUTO
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:328
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:60
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:186
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:53
bool UseOffScreenBuffers
Definition: vtkWindow.h:326
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:58
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL