Open3D (C++ API)  0.19.0
Loading...
Searching...
No Matches
open3d::visualization::gui::WidgetStack Class Reference

WidgetStack manages multiple widgets in a stack. More...

#include <WidgetStack.h>

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

Data Structures

struct  Impl

Public Member Functions

 WidgetStack ()
 ~WidgetStack () override
void PushWidget (std::shared_ptr< Widget > widget)
 Push a widget into stack so the it be the topmost widget.
std::shared_ptr< WidgetPopWidget ()
 Pop the top most widget.
void SetOnTop (std::function< void(std::shared_ptr< Widget >)> onTopCallback)
 Setup a callback while a widget is popped out and a new widget becomes the topmost one.
Public Member Functions inherited from open3d::visualization::gui::WidgetProxy
 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.
virtual std::shared_ptr< WidgetGetWidget ()
 Retrieve current delegated widget.
const RectGetFrame () const override
 Returns the frame size in pixels.
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 ()

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
Protected Member Functions inherited from open3d::visualization::gui::WidgetProxy
virtual std::shared_ptr< WidgetGetActiveWidget () const
Protected Member Functions inherited from open3d::visualization::gui::Widget
void DrawImGuiPushEnabledState ()
void DrawImGuiPopEnabledState ()
void DrawImGuiTooltip ()

Detailed Description

WidgetStack manages multiple widgets in a stack.

WidgetStack, like WidgetProxy, delegates at most one widget. Unlike WidgetProxy, it maintains multiple widgets. It saves all widgets pushed into by SetWidget and always shows the top one. The WidgetStack is a subclass of WidgetProxy, in another word, the topmost widget will delegate it self to WidgetStack. PopWidget will remove the topmost widget and callback set by SetOnTop taking the new topmost widget will be called. The WidgetStack disappears in GUI if there is no widget in stack.

Due to content and layout changing of the new widget, after SetWidget or PopWidget the relayout of Window might need be called.

Constructor & Destructor Documentation

◆ WidgetStack()

open3d::visualization::gui::WidgetStack::WidgetStack ( )

◆ ~WidgetStack()

open3d::visualization::gui::WidgetStack::~WidgetStack ( )
overridedefault

Member Function Documentation

◆ PopWidget()

std::shared_ptr< Widget > open3d::visualization::gui::WidgetStack::PopWidget ( )

Pop the top most widget.

Due to content and layout changing of the new widget, the relayout of Window might need be called.

Parameters
widgetWidget to push into stack to be topmost showing wiget.
Returns
widget is popped, or NULL if no widget in the stack.

◆ PushWidget()

void open3d::visualization::gui::WidgetStack::PushWidget ( std::shared_ptr< Widget > widget)

Push a widget into stack so the it be the topmost widget.

After a widget is pushed into stack, it will be shown in the GUI. Due to content and layout changing of the new widget, the relayout of Window might need be called.

Parameters
widgetWidget to push into stack to be topmost showing wiget.

◆ SetOnTop()

void open3d::visualization::gui::WidgetStack::SetOnTop ( std::function< void(std::shared_ptr< Widget >)> onTopCallback)

Setup a callback while a widget is popped out and a new widget becomes the topmost one.

Parameter of callback will be the new topmost widget.

Parameters
onTopCallbackCallback function taking the new topmost widget.

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