Open3D (C++ API)  0.18.0+252c867
WidgetProxy.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 
10 #include <memory>
11 #include <vector>
12 
15 
16 namespace open3d {
17 
18 namespace visualization {
19 namespace gui {
20 
47 class WidgetProxy : public Widget {
48 public:
49  WidgetProxy();
50  ~WidgetProxy() override;
51 
52  void AddChild(std::shared_ptr<Widget> child) override;
53  const std::vector<std::shared_ptr<Widget>> GetChildren() const override;
54 
65  virtual void SetWidget(std::shared_ptr<Widget> widget);
66 
71  virtual std::shared_ptr<Widget> GetWidget();
72 
73  const Rect& GetFrame() const override;
74  void SetFrame(const Rect& f) override;
75 
76  const Color& GetBackgroundColor() const override;
77  bool IsDefaultBackgroundColor() const override;
78  void SetBackgroundColor(const Color& color) override;
79 
80  bool IsVisible() const override;
81  void SetVisible(bool vis) override;
82 
83  bool IsEnabled() const override;
84  void SetEnabled(bool enabled) override;
85  void SetTooltip(const char* text) override;
86  const char* GetTooltip() const override;
88  const Constraints& constraints) const override;
89  Size CalcMinimumSize(const LayoutContext& context) const override;
90  void Layout(const LayoutContext& context) override;
91  DrawResult Draw(const DrawContext& context) override;
92  EventResult Mouse(const MouseEvent& e) override;
93  EventResult Key(const KeyEvent& e) override;
94  DrawResult Tick(const TickEvent& e) override;
95 
96 protected:
97  virtual std::shared_ptr<Widget> GetActiveWidget() const;
98 
99 private:
100  struct Impl;
101  std::unique_ptr<Impl> impl_;
102 };
103 
104 } // namespace gui
105 } // namespace visualization
106 } // namespace open3d
math::float4 color
Definition: LineSetBuffers.cpp:45
ImGuiContext * context
Definition: Window.cpp:76
Definition: Color.h:16
Definition: Widget.h:49
EventResult
Definition: Widget.h:103
DrawResult
Definition: Widget.h:95
Widget container to delegate any widget dynamically.
Definition: WidgetProxy.h:47
bool IsDefaultBackgroundColor() const override
Definition: WidgetProxy.cpp:71
void SetEnabled(bool enabled) override
Definition: WidgetProxy.cpp:110
bool IsEnabled() const override
Definition: WidgetProxy.cpp:102
DrawResult Tick(const TickEvent &e) override
Definition: WidgetProxy.cpp:196
virtual void SetWidget(std::shared_ptr< Widget > widget)
set a new widget to be delegated by this one.
Definition: WidgetProxy.cpp:27
const std::vector< std::shared_ptr< Widget > > GetChildren() const override
Definition: WidgetProxy.cpp:39
virtual std::shared_ptr< Widget > GetWidget()
Retrieve current delegated widget.
Definition: WidgetProxy.cpp:31
void SetFrame(const Rect &f) override
Definition: WidgetProxy.cpp:55
EventResult Mouse(const MouseEvent &e) override
Definition: WidgetProxy.cpp:174
EventResult Key(const KeyEvent &e) override
Definition: WidgetProxy.cpp:185
void SetVisible(bool vis) override
Definition: WidgetProxy.cpp:95
void SetTooltip(const char *text) override
Definition: WidgetProxy.cpp:117
WidgetProxy()
Definition: WidgetProxy.cpp:21
void SetBackgroundColor(const Color &color) override
Definition: WidgetProxy.cpp:79
const Rect & GetFrame() const override
Returns the frame size in pixels.
Definition: WidgetProxy.cpp:47
const Color & GetBackgroundColor() const override
Definition: WidgetProxy.cpp:63
void AddChild(std::shared_ptr< Widget > child) override
Definition: WidgetProxy.cpp:32
const char * GetTooltip() const override
Definition: WidgetProxy.cpp:125
virtual std::shared_ptr< Widget > GetActiveWidget() const
Definition: WidgetProxy.cpp:24
bool IsVisible() const override
Definition: WidgetProxy.cpp:87
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: WidgetProxy.cpp:133
DrawResult Draw(const DrawContext &context) override
Definition: WidgetProxy.cpp:157
void Layout(const LayoutContext &context) override
Definition: WidgetProxy.cpp:150
Size CalcMinimumSize(const LayoutContext &context) const override
Definition: WidgetProxy.cpp:142
~WidgetProxy() override
Definition: WidgetProxy.cpp:22
Definition: PinholeCameraIntrinsic.cpp:16
Definition: Events.h:203
Definition: WidgetProxy.cpp:16