ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
BitmapWindowSystem.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <functional>
11 #include <memory>
12 
14 
15 namespace cloudViewer {
16 
17 namespace core {
18 class Tensor;
19 }
20 
21 namespace visualization {
22 namespace gui {
23 
24 struct MouseEvent;
25 struct KeyEvent;
26 struct TextInputEvent;
27 
29 public:
30  enum class Rendering {
31  NORMAL, // normal OpenGL rendering, requires X11, Win32, or Cocoa
32  HEADLESS // uses EGL, does not require the OS to have a window system.
33  // (Linux only)
34  };
37 
38  void Initialize() override;
39  void Uninitialize() override;
40 
42  std::function<void(Window*, std::shared_ptr<core::Tensor>)>;
44 
45  void WaitEventsTimeout(double timeout_secs) override;
46 
48  int width,
49  int height,
50  const char* title,
51  int flags) override;
52  void DestroyWindow(OSWindow w) override;
53 
54  Size GetScreenSize(OSWindow w) override;
55 
56  void PostRedrawEvent(OSWindow w) override;
57  void PostMouseEvent(OSWindow w, const MouseEvent& e);
58  void PostKeyEvent(OSWindow w, const KeyEvent& e);
59  void PostTextInputEvent(OSWindow w, const TextInputEvent& e);
60 
61  bool GetWindowIsVisible(OSWindow w) const override;
62  void ShowWindow(OSWindow w, bool show) override;
63 
64  void RaiseWindowToTop(OSWindow w) override;
65  bool IsActiveWindow(OSWindow w) const override;
66 
67  Point GetWindowPos(OSWindow w) const override;
68  void SetWindowPos(OSWindow w, int x, int y) override;
69 
70  Size GetWindowSize(OSWindow w) const override;
71  void SetWindowSize(OSWindow w, int width, int height) override;
72 
73  Size GetWindowSizePixels(OSWindow w) const override;
74  void SetWindowSizePixels(OSWindow w, const Size& size) override;
75 
76  float GetWindowScaleFactor(OSWindow w) const override;
77  float GetUIScaleFactor(OSWindow w) const override;
78 
79  void SetWindowTitle(OSWindow w, const char* title) override;
80 
81  Point GetMousePosInWindow(OSWindow w) const override;
82  int GetMouseButtons(OSWindow w) const override;
83 
84  void CancelUserClose(OSWindow w) override;
85 
86  void* GetNativeDrawable(OSWindow w) override;
87 
89 
90  void ResizeRenderer(OSWindow w,
91  rendering::FilamentRenderer* renderer) override;
92 
93  MenuBase* CreateOSMenu() override;
94 
95 private:
96  struct Impl;
97  std::unique_ptr<Impl> impl_;
98 };
99 
100 } // namespace gui
101 } // namespace visualization
102 } // namespace cloudViewer
Window * o3d_window
std::function< void(std::shared_ptr< core::Tensor >)> callback
int width
int size
int height
void SetWindowTitle(OSWindow w, const char *title) override
std::function< void(Window *, std::shared_ptr< core::Tensor >)> OnDrawCallback
void PostTextInputEvent(OSWindow w, const TextInputEvent &e)
rendering::FilamentRenderer * CreateRenderer(OSWindow w) override
void SetWindowSizePixels(OSWindow w, const Size &size) override
void WaitEventsTimeout(double timeout_secs) override
void ResizeRenderer(OSWindow w, rendering::FilamentRenderer *renderer) override
void SetWindowPos(OSWindow w, int x, int y) override
OSWindow CreateOSWindow(Window *o3d_window, int width, int height, const char *title, int flags) override
void SetWindowSize(OSWindow w, int width, int height) override
void PostMouseEvent(OSWindow w, const MouseEvent &e)
Generic file read and write utility for python interface.