Open3D (C++ API)  0.18.0+fcf98ee
GLFWWindowSystem.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 struct GLFWwindow;
13 
14 namespace open3d {
15 namespace visualization {
16 namespace gui {
17 
19 public:
22 
23  void Initialize() override;
24  void Uninitialize() override;
25 
26  void WaitEventsTimeout(double timeout_secs) override;
27 
28  Size GetScreenSize(OSWindow w) override;
29 
31  int width,
32  int height,
33  const char* title,
34  int flags) override;
35  void DestroyWindow(OSWindow w) override;
36 
37  void PostRedrawEvent(OSWindow w) override;
38 
39  bool GetWindowIsVisible(OSWindow w) const override;
40  void ShowWindow(OSWindow w, bool show) override;
41 
42  void RaiseWindowToTop(OSWindow w) override;
43  bool IsActiveWindow(OSWindow w) const override;
44 
45  Point GetWindowPos(OSWindow w) const override;
46  void SetWindowPos(OSWindow w, int x, int y) override;
47 
48  Size GetWindowSize(OSWindow w) const override;
49  void SetWindowSize(OSWindow w, int width, int height) override;
50 
51  Size GetWindowSizePixels(OSWindow w) const override;
52  void SetWindowSizePixels(OSWindow w, const Size& size) override;
53 
54  float GetWindowScaleFactor(OSWindow w) const override;
55  float GetUIScaleFactor(OSWindow w) const override;
56 
57  void SetWindowTitle(OSWindow w, const char* title) override;
58 
59  Point GetMousePosInWindow(OSWindow w) const override;
60  int GetMouseButtons(OSWindow w) const override;
61 
62  void CancelUserClose(OSWindow w) override;
63 
64  void* GetNativeDrawable(OSWindow w) override;
65 
67 
68  void ResizeRenderer(OSWindow w,
69  rendering::FilamentRenderer* renderer) override;
70 
71  MenuBase* CreateOSMenu() override;
72 
73 private:
74  static void DrawCallback(GLFWwindow* window);
75  static void ResizeCallback(GLFWwindow* window, int os_width, int os_height);
76  static void WindowMovedCallback(GLFWwindow* window, int os_x, int os_y);
77  static void RescaleCallback(GLFWwindow* window, float xscale, float yscale);
78  static void MouseMoveCallback(GLFWwindow* window, double x, double y);
79  static void MouseButtonCallback(GLFWwindow* window,
80  int button,
81  int action,
82  int mods);
83  static void MouseScrollCallback(GLFWwindow* window, double dx, double dy);
84  static void KeyCallback(
85  GLFWwindow* window, int key, int scancode, int action, int mods);
86  static void CharCallback(GLFWwindow* window, unsigned int utf32char);
87  static void DragDropCallback(GLFWwindow*, int count, const char* paths[]);
88  static void CloseCallback(GLFWwindow* window);
89 };
90 
91 } // namespace gui
92 } // namespace visualization
93 } // namespace open3d
Window * o3d_window
Definition: BitmapWindowSystem.cpp:29
Definition: GLFWWindowSystem.h:18
Point GetWindowPos(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:223
void WaitEventsTimeout(double timeout_secs) override
Definition: GLFWWindowSystem.cpp:123
Point GetMousePosInWindow(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:279
void SetWindowTitle(OSWindow w, const char *title) override
Definition: GLFWWindowSystem.cpp:275
bool IsActiveWindow(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:219
void SetWindowSize(OSWindow w, int width, int height) override
Definition: GLFWWindowSystem.cpp:239
void CancelUserClose(OSWindow w) override
Definition: GLFWWindowSystem.cpp:301
void * GetNativeDrawable(OSWindow w) override
Definition: GLFWWindowSystem.cpp:521
Size GetWindowSize(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:233
rendering::FilamentRenderer * CreateRenderer(OSWindow w) override
Definition: GLFWWindowSystem.cpp:525
bool GetWindowIsVisible(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:203
Size GetScreenSize(OSWindow w) override
Definition: GLFWWindowSystem.cpp:131
GLFWWindowSystem()
Definition: GLFWWindowSystem.cpp:103
void ShowWindow(OSWindow w, bool show) override
Definition: GLFWWindowSystem.cpp:207
~GLFWWindowSystem()
Definition: GLFWWindowSystem.cpp:105
void SetWindowSizePixels(OSWindow w, const Size &size) override
Definition: GLFWWindowSystem.cpp:249
void RaiseWindowToTop(OSWindow w) override
Definition: GLFWWindowSystem.cpp:215
void SetWindowPos(OSWindow w, int x, int y) override
Definition: GLFWWindowSystem.cpp:229
int GetMouseButtons(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:286
Size GetWindowSizePixels(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:243
void Initialize() override
Definition: GLFWWindowSystem.cpp:107
float GetUIScaleFactor(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:269
void ResizeRenderer(OSWindow w, rendering::FilamentRenderer *renderer) override
Definition: GLFWWindowSystem.cpp:531
void Uninitialize() override
Definition: GLFWWindowSystem.cpp:121
void PostRedrawEvent(OSWindow w) override
Definition: GLFWWindowSystem.cpp:199
float GetWindowScaleFactor(OSWindow w) const override
Definition: GLFWWindowSystem.cpp:254
MenuBase * CreateOSMenu() override
Definition: GLFWWindowSystem.cpp:541
OSWindow CreateOSWindow(Window *o3d_window, int width, int height, const char *title, int flags) override
Definition: GLFWWindowSystem.cpp:154
void DestroyWindow(OSWindow w) override
Definition: GLFWWindowSystem.cpp:195
Definition: MenuBase.h:26
Definition: Window.h:30
Definition: WindowSystem.h:27
void * OSWindow
Definition: WindowSystem.h:29
int width
Definition: FilePCD.cpp:52
int size
Definition: FilePCD.cpp:40
int height
Definition: FilePCD.cpp:53
int count
Definition: FilePCD.cpp:42
Definition: PinholeCameraIntrinsic.cpp:16