Open3D (C++ API)  0.15.1
WidgetProxy.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-2021 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
34
35namespace open3d {
36
37namespace visualization {
38namespace gui {
39
66class WidgetProxy : public Widget {
67public:
69 ~WidgetProxy() override;
70
71 void AddChild(std::shared_ptr<Widget> child) override;
72 const std::vector<std::shared_ptr<Widget>> GetChildren() const override;
73
84 virtual void SetWidget(std::shared_ptr<Widget> widget);
85
90 virtual std::shared_ptr<Widget> GetWidget();
91
92 const Rect& GetFrame() const override;
93 void SetFrame(const Rect& f) override;
94
95 const Color& GetBackgroundColor() const override;
96 bool IsDefaultBackgroundColor() const override;
97 void SetBackgroundColor(const Color& color) override;
98
99 bool IsVisible() const override;
100 void SetVisible(bool vis) override;
101
102 bool IsEnabled() const override;
103 void SetEnabled(bool enabled) override;
104 void SetTooltip(const char* text) override;
105 const char* GetTooltip() const override;
107 const Constraints& constraints) const override;
108 Size CalcMinimumSize(const LayoutContext& context) const override;
109 void Layout(const LayoutContext& context) override;
110 DrawResult Draw(const DrawContext& context) override;
111 EventResult Mouse(const MouseEvent& e) override;
112 EventResult Key(const KeyEvent& e) override;
113 DrawResult Tick(const TickEvent& e) override;
114
115protected:
116 virtual std::shared_ptr<Widget> GetActiveWidget() const;
117
118private:
119 struct Impl;
120 std::unique_ptr<Impl> impl_;
121};
122
123} // namespace gui
124} // namespace visualization
125} // namespace open3d
math::float4 color
Definition: LineSetBuffers.cpp:64
ImGuiContext * context
Definition: Window.cpp:95
Definition: Color.h:35
Definition: Widget.h:68
EventResult
Definition: Widget.h:122
DrawResult
Definition: Widget.h:114
Widget container to delegate any widget dynamically.
Definition: WidgetProxy.h:66
bool IsDefaultBackgroundColor() const override
Definition: WidgetProxy.cpp:90
void SetEnabled(bool enabled) override
Definition: WidgetProxy.cpp:129
bool IsEnabled() const override
Definition: WidgetProxy.cpp:121
DrawResult Tick(const TickEvent &e) override
Definition: WidgetProxy.cpp:215
virtual void SetWidget(std::shared_ptr< Widget > widget)
set a new widget to be delegated by this one.
Definition: WidgetProxy.cpp:46
const std::vector< std::shared_ptr< Widget > > GetChildren() const override
Definition: WidgetProxy.cpp:58
virtual std::shared_ptr< Widget > GetWidget()
Retrieve current delegated widget.
Definition: WidgetProxy.cpp:50
void SetFrame(const Rect &f) override
Definition: WidgetProxy.cpp:74
EventResult Mouse(const MouseEvent &e) override
Definition: WidgetProxy.cpp:193
EventResult Key(const KeyEvent &e) override
Definition: WidgetProxy.cpp:204
void SetVisible(bool vis) override
Definition: WidgetProxy.cpp:114
void SetTooltip(const char *text) override
Definition: WidgetProxy.cpp:136
WidgetProxy()
Definition: WidgetProxy.cpp:40
void SetBackgroundColor(const Color &color) override
Definition: WidgetProxy.cpp:98
const Rect & GetFrame() const override
Returns the frame size in pixels.
Definition: WidgetProxy.cpp:66
const Color & GetBackgroundColor() const override
Definition: WidgetProxy.cpp:82
void AddChild(std::shared_ptr< Widget > child) override
Definition: WidgetProxy.cpp:51
const char * GetTooltip() const override
Definition: WidgetProxy.cpp:144
virtual std::shared_ptr< Widget > GetActiveWidget() const
Definition: WidgetProxy.cpp:43
bool IsVisible() const override
Definition: WidgetProxy.cpp:106
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: WidgetProxy.cpp:152
DrawResult Draw(const DrawContext &context) override
Definition: WidgetProxy.cpp:176
void Layout(const LayoutContext &context) override
Definition: WidgetProxy.cpp:169
Size CalcMinimumSize(const LayoutContext &context) const override
Definition: WidgetProxy.cpp:161
~WidgetProxy() override
Definition: WidgetProxy.cpp:41
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Events.h:222
Definition: WidgetProxy.cpp:35