Open3D (C++ API)
0.11.0
cpp
open3d
visualization
gui
Widget.h
Go to the documentation of this file.
1
// ----------------------------------------------------------------------------
2
// - Open3D: www.open3d.org -
3
// ----------------------------------------------------------------------------
4
// The MIT License (MIT)
5
//
6
// Copyright (c) 2018 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
29
#include <memory>
30
#include <vector>
31
32
#include "
open3d/visualization/gui/Gui.h
"
33
34
namespace
open3d
{
35
36
namespace
visualization {
37
namespace
rendering {
38
class
Renderer;
39
}
40
}
// namespace visualization
41
42
namespace
visualization {
43
namespace
gui {
44
45
class
Color;
46
struct
MouseEvent;
47
struct
KeyEvent;
48
struct
TickEvent;
49
struct
Theme;
50
51
struct
DrawContext
{
52
const
Theme
&
theme
;
53
visualization::rendering::Renderer
&
renderer
;
54
int
uiOffsetX
;
55
int
uiOffsetY
;
56
int
screenWidth
;
57
int
screenHeight
;
58
int
emPx
;
59
float
frameDelta
;
// in seconds
60
};
61
62
class
Widget
{
63
friend
class
Window
;
64
65
public
:
66
Widget
();
67
explicit
Widget
(
const
std::vector<std::shared_ptr<Widget>>& children);
68
virtual
~
Widget
();
69
70
void
AddChild(std::shared_ptr<Widget> child);
71
const
std::vector<std::shared_ptr<Widget>> GetChildren()
const
;
72
74
const
Rect
& GetFrame()
const
;
81
virtual
void
SetFrame(
const
Rect
& f);
82
83
const
Color
& GetBackgroundColor()
const
;
84
bool
IsDefaultBackgroundColor()
const
;
85
void
SetBackgroundColor(
const
Color
&
color
);
86
87
bool
IsVisible()
const
;
88
virtual
void
SetVisible(
bool
vis);
89
90
bool
IsEnabled()
const
;
91
virtual
void
SetEnabled(
bool
enabled);
92
93
static
constexpr
int
DIM_GROW = 10000;
94
virtual
Size
CalcPreferredSize(
const
Theme
& theme)
const
;
95
96
virtual
void
Layout(
const
Theme
& theme);
97
98
enum class
DrawResult
{ NONE, REDRAW, RELAYOUT };
104
virtual
DrawResult
Draw(
const
DrawContext
& context);
105
106
enum class
EventResult
{ IGNORED, CONSUMED, DISCARD };
107
111
virtual
EventResult
Mouse(
const
MouseEvent
& e);
112
116
virtual
EventResult
Key(
const
KeyEvent
& e);
117
121
virtual
DrawResult
Tick(
const
TickEvent
& e);
122
123
protected
:
124
void
DrawImGuiPushEnabledState();
125
void
DrawImGuiPopEnabledState();
126
127
private
:
128
struct
Impl
;
129
std::unique_ptr<Impl> impl_;
130
};
131
132
}
// namespace gui
133
}
// namespace visualization
134
}
// namespace open3d
open3d::visualization::gui::DrawContext::theme
const Theme & theme
Definition:
Widget.h:52
open3d::visualization::gui::Theme
Definition:
Theme.h:39
open3d::visualization::gui::Window
Definition:
Window.h:50
open3d::visualization::gui::DrawContext::renderer
visualization::rendering::Renderer & renderer
Definition:
Widget.h:53
open3d::visualization::gui::DrawContext::emPx
int emPx
Definition:
Widget.h:58
open3d::visualization::gui::Widget
Definition:
Widget.h:62
Gui.h
open3d::visualization::gui::MouseEvent
Definition:
Events.h:54
color
math::float4 color
Definition:
LineSetBuffers.cpp:63
open3d::visualization::gui::DrawContext::screenHeight
int screenHeight
Definition:
Widget.h:57
open3d::visualization::rendering::Renderer
Definition:
Renderer.h:65
open3d::visualization::gui::Rect
Definition:
Gui.h:49
open3d::visualization::gui::DrawContext::uiOffsetY
int uiOffsetY
Definition:
Widget.h:55
open3d::visualization::gui::TickEvent
Definition:
Events.h:75
open3d::visualization::gui::Widget::Impl
Definition:
Widget.cpp:43
open3d::visualization::gui::Widget::EventResult
EventResult
Definition:
Widget.h:106
open3d
Definition:
PinholeCameraIntrinsic.cpp:35
open3d::visualization::gui::DrawContext::screenWidth
int screenWidth
Definition:
Widget.h:56
open3d::visualization::gui::DrawContext
Definition:
Widget.h:51
open3d::visualization::gui::Size
Definition:
Gui.h:41
open3d::visualization::gui::DrawContext::frameDelta
float frameDelta
Definition:
Widget.h:59
open3d::visualization::gui::DrawContext::uiOffsetX
int uiOffsetX
Definition:
Widget.h:54
open3d::visualization::gui::KeyEvent
Definition:
Events.h:172
open3d::visualization::gui::Widget::DrawResult
DrawResult
Definition:
Widget.h:98
open3d::visualization::gui::Color
Definition:
Color.h:35
Generated by
1.8.13