![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
WidgetStack manages multiple widgets in a stack. More...
#include <WidgetStack.h>


Classes | |
| 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 cloudViewer::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 cloudViewer::visualization::gui::Widget | |
| Widget () | |
| Widget (const std::vector< std::shared_ptr< Widget >> &children) | |
| virtual | ~Widget () |
Additional Inherited Members | |
Public Types inherited from cloudViewer::visualization::gui::Widget | |
| enum class | DrawResult { NONE , REDRAW , RELAYOUT } |
| enum class | EventResult { IGNORED , CONSUMED , DISCARD } |
Static Public Attributes inherited from cloudViewer::visualization::gui::Widget | |
| static constexpr int | DIM_GROW = 10000 |
Protected Member Functions inherited from cloudViewer::visualization::gui::WidgetProxy | |
| virtual std::shared_ptr< Widget > | GetActiveWidget () const |
Protected Member Functions inherited from cloudViewer::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.
Definition at line 32 of file WidgetStack.h.
| cloudViewer::visualization::gui::WidgetStack::WidgetStack | ( | ) |
Definition at line 20 of file WidgetStack.cpp.
|
overridedefault |
| std::shared_ptr< Widget > cloudViewer::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.
| widget | Widget to push into stack to be topmost showing wiget. |
Definition at line 28 of file WidgetStack.cpp.
References cloudViewer::visualization::gui::WidgetProxy::SetWidget().
Referenced by cloudViewer::visualization::gui::pybind_gui_classes().
| void cloudViewer::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.
| widget | Widget to push into stack to be topmost showing wiget. |
Definition at line 23 of file WidgetStack.cpp.
References cloudViewer::visualization::gui::WidgetProxy::SetWidget().
Referenced by cloudViewer::visualization::gui::pybind_gui_classes().
| void cloudViewer::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. |
Definition at line 44 of file WidgetStack.cpp.
Referenced by cloudViewer::visualization::gui::pybind_gui_classes().