Open3D (C++ API)
Data Structures | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Friends
open3d::gui::Widget Class Reference

#include <Widget.h>

Inheritance diagram for open3d::gui::Widget:
open3d::gui::Button open3d::gui::Checkbox open3d::gui::ColorEdit open3d::gui::Combobox open3d::gui::Dialog open3d::gui::Label open3d::gui::Layout1D open3d::gui::Layout1D::Fixed open3d::gui::Layout1D::Stretch open3d::gui::ListView open3d::gui::NumberEdit open3d::gui::SceneWidget open3d::gui::Slider open3d::gui::TabControl open3d::gui::TextEdit open3d::gui::VectorEdit open3d::gui::VGrid

Data Structures

struct  Impl
 

Public Types

enum  DrawResult { DrawResult::NONE, DrawResult::REDRAW, DrawResult::RELAYOUT }
 
enum  EventResult { EventResult::IGNORED, EventResult::CONSUMED, EventResult::DISCARD }
 

Public Member Functions

 Widget ()
 
 Widget (const std::vector< std::shared_ptr< Widget >> &children)
 
virtual ~Widget ()
 
void AddChild (std::shared_ptr< Widget > child)
 
const std::vector< std::shared_ptr< Widget > > GetChildren () const
 
const RectGetFrame () const
 Returns the frame size in pixels. More...
 
virtual void SetFrame (const Rect &f)
 
const ColorGetBackgroundColor () const
 
bool IsDefaultBackgroundColor () const
 
void SetBackgroundColor (const Color &color)
 
bool IsVisible () const
 
virtual void SetVisible (bool vis)
 
bool IsEnabled () const
 
virtual void SetEnabled (bool enabled)
 
virtual Size CalcPreferredSize (const Theme &theme) const
 
virtual void Layout (const Theme &theme)
 
virtual DrawResult Draw (const DrawContext &context)
 
virtual EventResult Mouse (const MouseEvent &e)
 
virtual EventResult Key (const KeyEvent &e)
 
virtual DrawResult Tick (const TickEvent &e)
 

Static Public Attributes

static constexpr int DIM_GROW = 10000
 

Protected Member Functions

void DrawImGuiPushEnabledState ()
 
void DrawImGuiPopEnabledState ()
 

Friends

class Window
 

Member Enumeration Documentation

◆ DrawResult

Enumerator
NONE 
REDRAW 
RELAYOUT 

◆ EventResult

Enumerator
IGNORED 
CONSUMED 
DISCARD 

Constructor & Destructor Documentation

◆ Widget() [1/2]

open3d::gui::Widget::Widget ( )

◆ Widget() [2/2]

open3d::gui::Widget::Widget ( const std::vector< std::shared_ptr< Widget >> &  children)
explicit

◆ ~Widget()

open3d::gui::Widget::~Widget ( )
virtual

Member Function Documentation

◆ AddChild()

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

◆ CalcPreferredSize()

Size open3d::gui::Widget::CalcPreferredSize ( const Theme theme) const
virtual

◆ Draw()

Widget::DrawResult open3d::gui::Widget::Draw ( const DrawContext context)
virtual

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 in open3d::gui::CollapsableVert, open3d::gui::SceneWidget, open3d::gui::Combobox, open3d::gui::Slider, open3d::gui::NumberEdit, open3d::gui::ListView, open3d::gui::TextEdit, open3d::gui::VectorEdit, open3d::gui::Label, open3d::gui::Button, open3d::gui::ColorEdit, open3d::gui::Checkbox, open3d::gui::Dialog, and open3d::gui::TabControl.

◆ DrawImGuiPopEnabledState()

void open3d::gui::Widget::DrawImGuiPopEnabledState ( )
protected

◆ DrawImGuiPushEnabledState()

void open3d::gui::Widget::DrawImGuiPushEnabledState ( )
protected

◆ GetBackgroundColor()

const Color & open3d::gui::Widget::GetBackgroundColor ( ) const

◆ GetChildren()

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

◆ GetFrame()

const Rect & open3d::gui::Widget::GetFrame ( ) const

Returns the frame size in pixels.

◆ IsDefaultBackgroundColor()

bool open3d::gui::Widget::IsDefaultBackgroundColor ( ) const

◆ IsEnabled()

bool open3d::gui::Widget::IsEnabled ( ) const

◆ IsVisible()

bool open3d::gui::Widget::IsVisible ( ) const

◆ Key()

Widget::EventResult open3d::gui::Widget::Key ( const KeyEvent e)
virtual

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 in open3d::gui::SceneWidget.

◆ Layout()

void open3d::gui::Widget::Layout ( const Theme theme)
virtual

◆ Mouse()

Widget::EventResult open3d::gui::Widget::Mouse ( const MouseEvent e)
virtual

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 in open3d::gui::SceneWidget.

◆ SetBackgroundColor()

void open3d::gui::Widget::SetBackgroundColor ( const Color color)

◆ SetEnabled()

void open3d::gui::Widget::SetEnabled ( bool  enabled)
virtual

◆ SetFrame()

void open3d::gui::Widget::SetFrame ( const Rect f)
virtual

The frame is in pixels. The size of a pixel varies on different and operatings sytems 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 in open3d::gui::SceneWidget.

◆ SetVisible()

void open3d::gui::Widget::SetVisible ( bool  vis)
virtual

◆ Tick()

Widget::DrawResult open3d::gui::Widget::Tick ( const TickEvent e)
virtual

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 in open3d::gui::SceneWidget.

Friends And Related Function Documentation

◆ Window

friend class Window
friend

Field Documentation

◆ DIM_GROW

constexpr int open3d::gui::Widget::DIM_GROW = 10000
static

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