Open3D (C++ API)
0.17.0
|
WidgetStack manages multiple widgets in a stack. More...
#include <WidgetStack.h>
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. More... | |
std::shared_ptr< Widget > | PopWidget () |
Pop the top most widget. More... | |
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. More... | |
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. More... | |
virtual std::shared_ptr< Widget > | GetWidget () |
Retrieve current delegated widget. More... | |
const Rect & | GetFrame () const override |
Returns the frame size in pixels. More... | |
void | SetFrame (const Rect &f) override |
const Color & | GetBackgroundColor () 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< Widget > | GetActiveWidget () const |
Protected Member Functions inherited from open3d::visualization::gui::Widget | |
void | DrawImGuiPushEnabledState () |
void | DrawImGuiPopEnabledState () |
void | DrawImGuiTooltip () |
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.
open3d::visualization::gui::WidgetStack::WidgetStack | ( | ) |
|
overridedefault |
std::shared_ptr< Widget > open3d::visualization::gui::WidgetStack::PopWidget | ( | ) |
void open3d::visualization::gui::WidgetStack::PushWidget | ( | std::shared_ptr< Widget > | widget | ) |
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.
onTopCallback | Callback function taking the new topmost widget. |