Open3D (C++ API)  0.13.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
WindowSystem.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2020 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
30 
31 namespace open3d {
32 namespace visualization {
33 
34 namespace rendering {
35 class FilamentRenderer;
36 } // namespace rendering
37 
38 namespace gui {
39 
40 class MenuBase;
41 class Window;
42 
46 class WindowSystem {
47 public:
48  using OSWindow = void*;
49 
50  virtual ~WindowSystem(){};
51 
52  virtual void Initialize() = 0;
53  virtual void Uninitialize() = 0;
54 
55  virtual void WaitEventsTimeout(double timeout_secs) = 0;
56 
57  virtual Size GetScreenSize(OSWindow w) = 0;
58 
59  static constexpr int FLAG_VISIBLE = 0;
60  static constexpr int FLAG_HIDDEN = (1 << 0);
61  static constexpr int FLAG_TOPMOST = (1 << 1);
62 
63  virtual OSWindow CreateOSWindow(Window* o3d_window,
64  int width,
65  int height,
66  const char* title,
67  int flags) = 0;
68  virtual void DestroyWindow(OSWindow w) = 0;
69 
70  virtual void PostRedrawEvent(OSWindow w) = 0;
71 
72  virtual bool GetWindowIsVisible(OSWindow w) const = 0;
73  virtual void ShowWindow(OSWindow w, bool show) = 0;
74 
75  virtual void RaiseWindowToTop(OSWindow w) = 0;
76  virtual bool IsActiveWindow(OSWindow w) const = 0;
77 
78  virtual Point GetWindowPos(OSWindow w) const = 0;
79  virtual void SetWindowPos(OSWindow w, int x, int y) = 0;
80 
81  virtual Size GetWindowSize(OSWindow w) const = 0;
82  virtual void SetWindowSize(OSWindow w, int width, int height) = 0;
83 
84  virtual Size GetWindowSizePixels(OSWindow w) const = 0;
85  virtual void SetWindowSizePixels(OSWindow w, const Size& size) = 0;
86 
87  virtual float GetWindowScaleFactor(OSWindow w) const = 0;
88  virtual float GetUIScaleFactor(OSWindow w) const = 0;
89 
90  virtual void SetWindowTitle(OSWindow w, const char* title) = 0;
91 
92  virtual Point GetMousePosInWindow(OSWindow w) const = 0;
93  virtual int GetMouseButtons(OSWindow w) const = 0;
94 
95  virtual void CancelUserClose(OSWindow w) = 0;
96 
97  virtual void* GetNativeDrawable(OSWindow w) = 0;
98 
99  // Creates an appropriate renderer with new(). It is the caller's
100  // responsibility to delete it.
101  virtual rendering::FilamentRenderer* CreateRenderer(OSWindow w) = 0;
102 
103  virtual void ResizeRenderer(OSWindow w,
104  rendering::FilamentRenderer* renderer) = 0;
105 
106  virtual MenuBase* CreateOSMenu() = 0;
107 };
108 
109 } // namespace gui
110 } // namespace visualization
111 } // namespace open3d
Definition: Window.h:49
virtual ~WindowSystem()
Definition: WindowSystem.h:50
Definition: MenuBase.h:45
void * GetNativeDrawable(GLFWwindow *glfw_window)
Definition: NativeLinux.cpp:39
int size
Definition: FilePCD.cpp:59
Definition: PinholeCameraIntrinsic.cpp:35
Window * o3d_window
Definition: BitmapWindowSystem.cpp:47
void * OSWindow
Definition: WindowSystem.h:48
int height
Definition: FilePCD.cpp:72
int width
Definition: FilePCD.cpp:71
Definition: WindowSystem.h:46