Open3D (C++ API)
0.17.0
|
Widget container to delegate any widget dynamically. More...
#include <WidgetProxy.h>
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< 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 () |
Protected Member Functions | |
virtual std::shared_ptr< Widget > | GetActiveWidget () 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 |
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.
open3d::visualization::gui::WidgetProxy::WidgetProxy | ( | ) |
|
override |
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
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.
|
protectedvirtual |
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Returns the frame size in pixels.
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
virtual |
Retrieve current delegated widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
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.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
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.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
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.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::Widget.
|
overridevirtual |
Reimplemented from open3d::visualization::gui::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.
widget | Any widget to be delegated. Set to NULL to clear current delegated proxy. |
|
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.