ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Gui.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 namespace cloudViewer {
11 namespace visualization {
12 namespace gui {
13 
14 struct Point {
15  int x;
16  int y;
17 
18  Point();
19  Point(int x_, int y_);
20 };
21 
22 struct Size {
23  int width;
24  int height;
25 
26  Size();
27  Size(int w, int h);
28 };
29 
30 struct Rect {
31  int x;
32  int y;
33  int width;
34  int height;
35 
36  Rect();
37  Rect(int x_, int y_, int w_, int h_);
38 
39  int GetTop() const;
40  int GetBottom() const;
41  int GetLeft() const;
42  int GetRight() const;
43 
44  bool Contains(int x, int y) const;
45  bool Contains(const Point& pt) const;
46 
47  Rect UnionedWith(const Rect& r) const;
48 
49  bool operator==(const Rect& other) const;
50  bool operator!=(const Rect& other) const;
51 };
52 
53 enum class BorderShape { NONE = 0, RECT, ROUNDED_RECT };
54 
55 enum class Alignment : unsigned int {
56  LEFT = 1,
57  HCENTER = 2,
58  RIGHT = 3,
59  TOP = (1 << 4),
60  VCENTER = (2 << 4),
61  BOTTOM = (3 << 4),
62  CENTER = (2 | (2 << 4))
63 };
65  return Alignment((unsigned int)(x) | (unsigned int)(y));
66 }
67 
68 using FontId = unsigned int;
69 
70 enum class FontStyle {
71  NORMAL = 0,
72  BOLD = 1,
73  ITALIC = 2,
74  BOLD_ITALIC = 3
75 };
76 
77 class FontContext {
78 public:
79  virtual ~FontContext() {};
80 
81  virtual void* GetFont(FontId font_id) = 0;
82 };
83 
84 } // namespace gui
85 } // namespace visualization
86 } // namespace cloudViewer
virtual void * GetFont(FontId font_id)=0
constexpr Alignment operator|(Alignment x, Alignment y)
Definition: Gui.h:64
Generic file read and write utility for python interface.
Rect UnionedWith(const Rect &r) const
Definition: Gui.cpp:46
bool operator!=(const Rect &other) const
Definition: Gui.cpp:59
bool Contains(int x, int y) const
Definition: Gui.cpp:39
bool operator==(const Rect &other) const
Definition: Gui.cpp:54