Open3D (C++ API)  0.18.0+fcf98ee
Data Structures | Public Member Functions | Protected Member Functions
open3d::visualization::gui::WidgetProxy Class Reference

Widget container to delegate any widget dynamically. More...

#include <WidgetProxy.h>

Inheritance diagram for open3d::visualization::gui::WidgetProxy:
open3d::visualization::gui::Widget open3d::visualization::gui::WidgetStack

Data Structures

struct  Impl
 

Public Member Functions

 WidgetProxy ()
 
 ~WidgetProxy () override
 
void AddChild (std::shared_ptr< Widget > child) override
 
const std::vector< std::shared_ptr< Widget > > GetChildren () const override
 
virtual void SetWidget (std::shared_ptr< Widget > widget)
 set a new widget to be delegated by this one. More...
 
virtual std::shared_ptr< WidgetGetWidget ()
 Retrieve current delegated widget. More...
 
const RectGetFrame () const override
 Returns the frame size in pixels. More...
 
void SetFrame (const Rect &f) override
 
const ColorGetBackgroundColor () const override
 
bool IsDefaultBackgroundColor () const override
 
void SetBackgroundColor (const Color &color) override
 
bool IsVisible () const override
 
void SetVisible (bool vis) override
 
bool IsEnabled () const override
 
void SetEnabled (bool enabled) override
 
void SetTooltip (const char *text) override
 
const char * GetTooltip () const override
 
Size CalcPreferredSize (const LayoutContext &context, const Constraints &constraints) const override
 
Size CalcMinimumSize (const LayoutContext &context) const override
 
void Layout (const LayoutContext &context) override
 
DrawResult Draw (const DrawContext &context) override
 
EventResult Mouse (const MouseEvent &e) override
 
EventResult Key (const KeyEvent &e) override
 
DrawResult Tick (const TickEvent &e) override
 
- Public Member Functions inherited from open3d::visualization::gui::Widget
 Widget ()
 
 Widget (const std::vector< std::shared_ptr< Widget >> &children)
 
virtual ~Widget ()
 

Protected Member Functions

virtual std::shared_ptr< WidgetGetActiveWidget () const
 
- Protected Member Functions inherited from open3d::visualization::gui::Widget
void DrawImGuiPushEnabledState ()
 
void DrawImGuiPopEnabledState ()
 
void DrawImGuiTooltip ()
 

Additional Inherited Members

- Public Types inherited from open3d::visualization::gui::Widget
enum class  DrawResult { NONE , REDRAW , RELAYOUT }
 
enum class  EventResult { IGNORED , CONSUMED , DISCARD }
 
- Static Public Attributes inherited from open3d::visualization::gui::Widget
static constexpr int DIM_GROW = 10000
 

Detailed Description

Widget container to delegate any widget dynamically.

Widget can not be managed dynamically. Although it is allowed to add more child widgets, it's impossible to replace some child with new on or remove children. WidgetProxy is designed to solve this problem.

When WidgetProxy is created, it's invisible and disabled, so it won't be drawn or layout, seeming like it does not exist. When a widget is set by SetWidget, all Widget's APIs will be conducted to that child widget. It looks like WidgetProxy is that widget.

At any time, a new widget could be set, to replace the old one. and the old widget will be destroyed.

Due to the content changing after a new widget is set or cleared, a relayout of Window might be called after SetWidget.

The delegated widget could be retrieved by GetWidget in case you need to access it directly, like get check status of a CheckBox.

API other than SetWidget and GetWidget has completely same function as Widget.

Constructor & Destructor Documentation

◆ WidgetProxy()

open3d::visualization::gui::WidgetProxy::WidgetProxy ( )

◆ ~WidgetProxy()

open3d::visualization::gui::WidgetProxy::~WidgetProxy ( )
override

Member Function Documentation

◆ AddChild()

void open3d::visualization::gui::WidgetProxy::AddChild ( std::shared_ptr< Widget child)
overridevirtual

◆ CalcMinimumSize()

Size open3d::visualization::gui::WidgetProxy::CalcMinimumSize ( const LayoutContext context) const
overridevirtual

◆ CalcPreferredSize()

Size open3d::visualization::gui::WidgetProxy::CalcPreferredSize ( const LayoutContext context,
const Constraints constraints 
) const
overridevirtual

◆ Draw()

Widget::DrawResult open3d::visualization::gui::WidgetProxy::Draw ( const DrawContext context)
overridevirtual

Draws the widget. If this is a Dear ImGUI widget, this is where the actual event processing happens. Return NONE if no action needs to be taken, REDRAW if the widget needs to be redrawn (e.g. its value changed), and RELAYOUT if the widget wishes to change size.

Reimplemented from open3d::visualization::gui::Widget.

◆ GetActiveWidget()

std::shared_ptr< Widget > open3d::visualization::gui::WidgetProxy::GetActiveWidget ( ) const
protectedvirtual

◆ GetBackgroundColor()

const Color & open3d::visualization::gui::WidgetProxy::GetBackgroundColor ( ) const
overridevirtual

◆ GetChildren()

const std::vector< std::shared_ptr< Widget > > open3d::visualization::gui::WidgetProxy::GetChildren ( ) const
overridevirtual

◆ GetFrame()

const Rect & open3d::visualization::gui::WidgetProxy::GetFrame ( ) const
overridevirtual

Returns the frame size in pixels.

Reimplemented from open3d::visualization::gui::Widget.

◆ GetTooltip()

const char * open3d::visualization::gui::WidgetProxy::GetTooltip ( ) const
overridevirtual

◆ GetWidget()

std::shared_ptr< Widget > open3d::visualization::gui::WidgetProxy::GetWidget ( )
virtual

Retrieve current delegated widget.

Returns
Instance of current delegated widget set by SetWidget. An empty pointer will be returned if there is none.

◆ IsDefaultBackgroundColor()

bool open3d::visualization::gui::WidgetProxy::IsDefaultBackgroundColor ( ) const
overridevirtual

◆ IsEnabled()

bool open3d::visualization::gui::WidgetProxy::IsEnabled ( ) const
overridevirtual

◆ IsVisible()

bool open3d::visualization::gui::WidgetProxy::IsVisible ( ) const
overridevirtual

◆ Key()

Widget::EventResult open3d::visualization::gui::WidgetProxy::Key ( const KeyEvent e)
overridevirtual

Widgets that use Dear ImGUI should not need to override this, as Dear ImGUI will take care of all the key handling during the Draw().

Reimplemented from open3d::visualization::gui::Widget.

◆ Layout()

void open3d::visualization::gui::WidgetProxy::Layout ( const LayoutContext context)
overridevirtual

◆ Mouse()

Widget::EventResult open3d::visualization::gui::WidgetProxy::Mouse ( const MouseEvent e)
overridevirtual

Widgets that use Dear ImGUI should not need to override this, as Dear ImGUI will take care of all the mouse handling during the Draw().

Reimplemented from open3d::visualization::gui::Widget.

◆ SetBackgroundColor()

void open3d::visualization::gui::WidgetProxy::SetBackgroundColor ( const Color color)
overridevirtual

◆ SetEnabled()

void open3d::visualization::gui::WidgetProxy::SetEnabled ( bool  enabled)
overridevirtual

◆ SetFrame()

void open3d::visualization::gui::WidgetProxy::SetFrame ( const Rect f)
overridevirtual

The frame is in pixels. The size of a pixel varies on different and operating systems now frequently scale text sizes on high DPI monitors. Prefer using a Layout to using this function, but if you must use it, it is best to use a multiple of Window::GetTheme().fontSize, which represents 1em and is scaled according to the scaling factor of the window.

Reimplemented from open3d::visualization::gui::Widget.

◆ SetTooltip()

void open3d::visualization::gui::WidgetProxy::SetTooltip ( const char *  text)
overridevirtual

◆ SetVisible()

void open3d::visualization::gui::WidgetProxy::SetVisible ( bool  vis)
overridevirtual

◆ SetWidget()

void open3d::visualization::gui::WidgetProxy::SetWidget ( std::shared_ptr< Widget widget)
virtual

set a new widget to be delegated by this one.

After SetWidget, the previously delegated widget will be abandon, all calls to Widget's API will be conducted to widget.

Before any SetWidget call, this widget is invisible and disabled, seems it does not exist because it won't be drawn or in a layout.

Parameters
widgetAny widget to be delegated. Set to NULL to clear current delegated proxy.

◆ Tick()

Widget::DrawResult open3d::visualization::gui::WidgetProxy::Tick ( const TickEvent e)
overridevirtual

Tick events are sent regularly and allow for things like smoothly moving the camera based on keys that are pressed, or animations. Return DrawResult::REDRAW if you want to be redrawn.

Reimplemented from open3d::visualization::gui::Widget.


The documentation for this class was generated from the following files: