Open3D (C++ API)  0.19.0
Loading...
Searching...
No Matches
WindowSystem.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2024 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7
8#pragma once
9
10#include <string>
11
13
14namespace open3d {
15namespace visualization {
16
17namespace rendering {
18class FilamentRenderer;
19} // namespace rendering
20
21namespace gui {
22
23class MenuBase;
24class Window;
25
30public:
31 using OSWindow = void*;
32
33 virtual ~WindowSystem() {};
34
35 virtual void Initialize() = 0;
36 virtual void Uninitialize() = 0;
37
38 virtual void WaitEventsTimeout(double timeout_secs) = 0;
39
40 virtual Size GetScreenSize(OSWindow w) = 0;
41
42 static constexpr int FLAG_VISIBLE = 0;
43 static constexpr int FLAG_HIDDEN = (1 << 0);
44 static constexpr int FLAG_TOPMOST = (1 << 1);
45
47 int width,
48 int height,
49 const char* title,
50 int flags) = 0;
51 virtual void DestroyWindow(OSWindow w) = 0;
52
53 virtual void PostRedrawEvent(OSWindow w) = 0;
54
55 virtual bool GetWindowIsVisible(OSWindow w) const = 0;
56 virtual void ShowWindow(OSWindow w, bool show) = 0;
57
58 virtual void RaiseWindowToTop(OSWindow w) = 0;
59 virtual bool IsActiveWindow(OSWindow w) const = 0;
60
61 virtual Point GetWindowPos(OSWindow w) const = 0;
62 virtual void SetWindowPos(OSWindow w, int x, int y) = 0;
63
64 virtual Size GetWindowSize(OSWindow w) const = 0;
65 virtual void SetWindowSize(OSWindow w, int width, int height) = 0;
66
67 // Returns total window-decoration extents as Size(left+right, top+bottom)
68 // so callers can subtract them from the screen work area before sizing.
69 virtual Size GetWindowFrameSize(OSWindow w) const = 0;
70
71 virtual Size GetWindowSizePixels(OSWindow w) const = 0;
72 virtual void SetWindowSizePixels(OSWindow w, const Size& size) = 0;
73
74 virtual float GetWindowScaleFactor(OSWindow w) const = 0;
75 virtual float GetUIScaleFactor(OSWindow w) const = 0;
76
77 virtual void SetWindowTitle(OSWindow w, const char* title) = 0;
78
79 virtual Point GetMousePosInWindow(OSWindow w) const = 0;
80 virtual int GetMouseButtons(OSWindow w) const = 0;
81
82 virtual void CancelUserClose(OSWindow w) = 0;
83
84 virtual void* GetNativeDrawable(OSWindow w) = 0;
85
86 // Creates an appropriate renderer with new(). It is the caller's
87 // responsibility to delete it.
89
90 virtual void ResizeRenderer(OSWindow w,
91 rendering::FilamentRenderer* renderer) = 0;
92
93 virtual MenuBase* CreateOSMenu() = 0;
94
98 virtual void SetClipboardText(OSWindow w, const char* text) {}
99
103 virtual std::string GetClipboardText(OSWindow w) { return ""; }
104};
105
106} // namespace gui
107} // namespace visualization
108} // namespace open3d
Window * o3d_window
Definition BitmapWindowSystem.cpp:30
Definition MenuBase.h:26
Definition WindowSystem.h:29
virtual Point GetMousePosInWindow(OSWindow w) const =0
virtual std::string GetClipboardText(OSWindow w)
Definition WindowSystem.h:103
virtual bool IsActiveWindow(OSWindow w) const =0
virtual Size GetScreenSize(OSWindow w)=0
static constexpr int FLAG_TOPMOST
Definition WindowSystem.h:44
virtual Size GetWindowSize(OSWindow w) const =0
virtual ~WindowSystem()
Definition WindowSystem.h:33
virtual void * GetNativeDrawable(OSWindow w)=0
virtual void SetWindowTitle(OSWindow w, const char *title)=0
virtual bool GetWindowIsVisible(OSWindow w) const =0
virtual void SetClipboardText(OSWindow w, const char *text)
Definition WindowSystem.h:98
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:43
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:31
virtual Size GetWindowFrameSize(OSWindow w) const =0
virtual void WaitEventsTimeout(double timeout_secs)=0
virtual void ShowWindow(OSWindow w, bool show)=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 rendering::FilamentRenderer * CreateRenderer(OSWindow w)=0
virtual void PostRedrawEvent(OSWindow w)=0
static constexpr int FLAG_VISIBLE
Definition WindowSystem.h:42
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:53
int size
Definition FilePCD.cpp:41
int height
Definition FilePCD.cpp:54
Definition PinholeCameraIntrinsic.cpp:16