Open3D (C++ API)  0.18.0+252c867
WindowSystem.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
11 
12 namespace open3d {
13 namespace visualization {
14 
15 namespace rendering {
16 class FilamentRenderer;
17 } // namespace rendering
18 
19 namespace gui {
20 
21 class MenuBase;
22 class Window;
23 
27 class WindowSystem {
28 public:
29  using OSWindow = void*;
30 
31  virtual ~WindowSystem(){};
32 
33  virtual void Initialize() = 0;
34  virtual void Uninitialize() = 0;
35 
36  virtual void WaitEventsTimeout(double timeout_secs) = 0;
37 
38  virtual Size GetScreenSize(OSWindow w) = 0;
39 
40  static constexpr int FLAG_VISIBLE = 0;
41  static constexpr int FLAG_HIDDEN = (1 << 0);
42  static constexpr int FLAG_TOPMOST = (1 << 1);
43 
45  int width,
46  int height,
47  const char* title,
48  int flags) = 0;
49  virtual void DestroyWindow(OSWindow w) = 0;
50 
51  virtual void PostRedrawEvent(OSWindow w) = 0;
52 
53  virtual bool GetWindowIsVisible(OSWindow w) const = 0;
54  virtual void ShowWindow(OSWindow w, bool show) = 0;
55 
56  virtual void RaiseWindowToTop(OSWindow w) = 0;
57  virtual bool IsActiveWindow(OSWindow w) const = 0;
58 
59  virtual Point GetWindowPos(OSWindow w) const = 0;
60  virtual void SetWindowPos(OSWindow w, int x, int y) = 0;
61 
62  virtual Size GetWindowSize(OSWindow w) const = 0;
63  virtual void SetWindowSize(OSWindow w, int width, int height) = 0;
64 
65  virtual Size GetWindowSizePixels(OSWindow w) const = 0;
66  virtual void SetWindowSizePixels(OSWindow w, const Size& size) = 0;
67 
68  virtual float GetWindowScaleFactor(OSWindow w) const = 0;
69  virtual float GetUIScaleFactor(OSWindow w) const = 0;
70 
71  virtual void SetWindowTitle(OSWindow w, const char* title) = 0;
72 
73  virtual Point GetMousePosInWindow(OSWindow w) const = 0;
74  virtual int GetMouseButtons(OSWindow w) const = 0;
75 
76  virtual void CancelUserClose(OSWindow w) = 0;
77 
78  virtual void* GetNativeDrawable(OSWindow w) = 0;
79 
80  // Creates an appropriate renderer with new(). It is the caller's
81  // responsibility to delete it.
83 
84  virtual void ResizeRenderer(OSWindow w,
85  rendering::FilamentRenderer* renderer) = 0;
86 
87  virtual MenuBase* CreateOSMenu() = 0;
88 };
89 
90 } // namespace gui
91 } // namespace visualization
92 } // namespace open3d
Window * o3d_window
Definition: BitmapWindowSystem.cpp:29
Definition: MenuBase.h:26
Definition: Window.h:30
Definition: WindowSystem.h:27
virtual Point GetMousePosInWindow(OSWindow w) const =0
virtual bool IsActiveWindow(OSWindow w) const =0
virtual Size GetScreenSize(OSWindow w)=0
static constexpr int FLAG_TOPMOST
Definition: WindowSystem.h:42
virtual Size GetWindowSize(OSWindow w) const =0
virtual ~WindowSystem()
Definition: WindowSystem.h:31
virtual void SetWindowTitle(OSWindow w, const char *title)=0
virtual bool GetWindowIsVisible(OSWindow w) const =0
virtual void SetWindowSizePixels(OSWindow w, const Size &size)=0
virtual void ResizeRenderer(OSWindow w, rendering::FilamentRenderer *renderer)=0
virtual void DestroyWindow(OSWindow w)=0
virtual void RaiseWindowToTop(OSWindow w)=0
static constexpr int FLAG_HIDDEN
Definition: WindowSystem.h:41
virtual OSWindow CreateOSWindow(Window *o3d_window, int width, int height, const char *title, int flags)=0
virtual void SetWindowPos(OSWindow w, int x, int y)=0
void * OSWindow
Definition: WindowSystem.h:29
virtual rendering::FilamentRenderer * CreateRenderer(OSWindow w)=0
virtual void WaitEventsTimeout(double timeout_secs)=0
virtual void ShowWindow(OSWindow w, bool show)=0
virtual void * GetNativeDrawable(OSWindow w)=0
virtual Point GetWindowPos(OSWindow w) const =0
virtual void CancelUserClose(OSWindow w)=0
virtual float GetUIScaleFactor(OSWindow w) const =0
virtual void SetWindowSize(OSWindow w, int width, int height)=0
virtual void PostRedrawEvent(OSWindow w)=0
static constexpr int FLAG_VISIBLE
Definition: WindowSystem.h:40
virtual Size GetWindowSizePixels(OSWindow w) const =0
virtual float GetWindowScaleFactor(OSWindow w) const =0
virtual int GetMouseButtons(OSWindow w) const =0
int width
Definition: FilePCD.cpp:52
int size
Definition: FilePCD.cpp:40
int height
Definition: FilePCD.cpp:53
Definition: PinholeCameraIntrinsic.cpp:16