Loading [MathJax]/extensions/TeX/AMSsymbols.js
Open3D (C++ API)  0.16.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 
35 namespace open3d {
36 
37 namespace visualization {
38 namespace gui {
39 
66 class WidgetProxy : public Widget {
67 public:
68  WidgetProxy();
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 
115 protected:
116  virtual std::shared_ptr<Widget> GetActiveWidget() const;
117 
118 private:
119  struct Impl;
120  std::unique_ptr<Impl> impl_;
121 };
122 
123 } // namespace gui
124 } // namespace visualization
125 } // namespace open3d
EventResult Mouse(const MouseEvent &e) override
Definition: WidgetProxy.cpp:193
void Layout(const LayoutContext &context) override
Definition: WidgetProxy.cpp:169
Definition: WidgetProxy.cpp:35
void SetBackgroundColor(const Color &color) override
Definition: WidgetProxy.cpp:98
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 SetVisible(bool vis) override
Definition: WidgetProxy.cpp:114
Definition: Widget.h:68
bool IsEnabled() const override
Definition: WidgetProxy.cpp:121
virtual std::shared_ptr< Widget > GetActiveWidget() const
Definition: WidgetProxy.cpp:43
const char * GetTooltip() const override
Definition: WidgetProxy.cpp:144
ImGuiContext * context
Definition: Window.cpp:95
EventResult Key(const KeyEvent &e) override
Definition: WidgetProxy.cpp:204
const std::vector< std::shared_ptr< Widget > > GetChildren() const override
Definition: WidgetProxy.cpp:58
math::float4 color
Definition: LineSetBuffers.cpp:64
Widget container to delegate any widget dynamically.
Definition: WidgetProxy.h:66
DrawResult Tick(const TickEvent &e) override
Definition: WidgetProxy.cpp:215
bool IsVisible() const override
Definition: WidgetProxy.cpp:106
const Color & GetBackgroundColor() const override
Definition: WidgetProxy.cpp:82
virtual void SetWidget(std::shared_ptr< Widget > widget)
set a new widget to be delegated by this one.
Definition: WidgetProxy.cpp:46
void SetEnabled(bool enabled) override
Definition: WidgetProxy.cpp:129
void SetTooltip(const char *text) override
Definition: WidgetProxy.cpp:136
const Rect & GetFrame() const override
Returns the frame size in pixels.
Definition: WidgetProxy.cpp:66
void AddChild(std::shared_ptr< Widget > child) override
Definition: WidgetProxy.cpp:51
EventResult
Definition: Widget.h:122
Definition: PinholeCameraIntrinsic.cpp:35
void SetFrame(const Rect &f) override
Definition: WidgetProxy.cpp:74
virtual std::shared_ptr< Widget > GetWidget()
Retrieve current delegated widget.
Definition: WidgetProxy.cpp:50
Size CalcMinimumSize(const LayoutContext &context) const override
Definition: WidgetProxy.cpp:161
bool IsDefaultBackgroundColor() const override
Definition: WidgetProxy.cpp:90
WidgetProxy()
Definition: WidgetProxy.cpp:40
Definition: Events.h:222
~WidgetProxy() override
Definition: WidgetProxy.cpp:41
DrawResult
Definition: Widget.h:114
Definition: Color.h:35