ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::visualization::gui::TreeView Class Reference

#include <TreeView.h>

Inheritance diagram for cloudViewer::visualization::gui::TreeView:
[legend]
Collaboration diagram for cloudViewer::visualization::gui::TreeView:
[legend]

Classes

struct  Impl
 

Public Types

using ItemId = int
 
- Public Types inherited from cloudViewer::visualization::gui::Widget
enum  DrawResult { DrawResult::NONE, DrawResult::REDRAW, DrawResult::RELAYOUT }
 
enum  EventResult { EventResult::IGNORED, EventResult::CONSUMED, EventResult::DISCARD }
 

Public Member Functions

 TreeView ()
 
 ~TreeView ()
 
ItemId GetRootItem () const
 
ItemId AddItem (ItemId parent_id, std::shared_ptr< Widget > item)
 Adds an item to the tree. More...
 
ItemId AddTextItem (ItemId parent_id, const char *text)
 Adds a text item to the tree. More...
 
void RemoveItem (ItemId item_id)
 Removes an item an all its children (if any) from the tree. More...
 
void Clear ()
 Clears all the items. More...
 
std::shared_ptr< Widget > GetItem (ItemId item_id) const
 Returns item, or nullptr if item_id cannot be found. More...
 
std::vector< ItemId > GetItemChildren (ItemId parent_id) const
 
bool GetCanSelectItemsWithChildren () const
 
void SetCanSelectItemsWithChildren (bool can_select)
 
ItemId GetSelectedItemId () const
 Returns the currently selected item id in the tree. More...
 
void SetSelectedItemId (ItemId item_id)
 Selects the indicated item of the list. Does not call onValueChanged. More...
 
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
 
void SetOnSelectionChanged (std::function< void(ItemId)> on_selection_changed)
 
- Public Member Functions inherited from cloudViewer::visualization::gui::Widget
 Widget ()
 
 Widget (const std::vector< std::shared_ptr< Widget >> &children)
 
virtual ~Widget ()
 
virtual void AddChild (std::shared_ptr< Widget > child)
 
virtual const std::vector< std::shared_ptr< Widget > > GetChildren () const
 
virtual const Rect & GetFrame () const
 Returns the frame size in pixels. More...
 
virtual void SetFrame (const Rect &f)
 
virtual const Color & GetBackgroundColor () const
 
virtual bool IsDefaultBackgroundColor () const
 
virtual void SetBackgroundColor (const Color &color)
 
virtual bool IsVisible () const
 
virtual void SetVisible (bool vis)
 
virtual bool IsEnabled () const
 
virtual void SetEnabled (bool enabled)
 
virtual void SetTooltip (const char *text)
 
virtual const char * GetTooltip () const
 
virtual EventResult Mouse (const MouseEvent &e)
 
virtual EventResult Key (const KeyEvent &e)
 
virtual DrawResult Tick (const TickEvent &e)
 

Additional Inherited Members

- Static Public Attributes inherited from cloudViewer::visualization::gui::Widget
static constexpr int DIM_GROW = 10000
 
- Protected Member Functions inherited from cloudViewer::visualization::gui::Widget
void DrawImGuiPushEnabledState ()
 
void DrawImGuiPopEnabledState ()
 
void DrawImGuiTooltip ()
 

Member Typedef Documentation

◆ ItemId

Constructor & Destructor Documentation

◆ TreeView()

cloudViewer::visualization::gui::TreeView::TreeView ( )

◆ ~TreeView()

cloudViewer::visualization::gui::TreeView::~TreeView ( )

Member Function Documentation

◆ AddItem()

◆ AddTextItem()

TreeView::ItemId cloudViewer::visualization::gui::TreeView::AddTextItem ( ItemId  parent_id,
const char *  text 
)

Adds a text item to the tree.

References AddItem().

◆ CalcMinimumSize()

Size cloudViewer::visualization::gui::TreeView::CalcMinimumSize ( const LayoutContext &  context) const
overridevirtual

Reimplemented from cloudViewer::visualization::gui::Widget.

References context.

◆ CalcPreferredSize()

Size cloudViewer::visualization::gui::TreeView::CalcPreferredSize ( const LayoutContext &  context,
const Constraints &  constraints 
) const
overridevirtual

◆ Clear()

void cloudViewer::visualization::gui::TreeView::Clear ( )

Clears all the items.

◆ Draw()

Widget::DrawResult cloudViewer::visualization::gui::TreeView::Draw ( const DrawContext &  context)
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 cloudViewer::visualization::gui::Widget.

References cloudViewer::visualization::gui::colorToImgui(), cloudViewer::visualization::gui::colorToImguiRGBA(), context, cloudViewer::visualization::gui::Widget::DrawImGuiPopEnabledState(), cloudViewer::visualization::gui::Widget::DrawImGuiPushEnabledState(), frame, cloudViewer::visualization::gui::Widget::GetFrame(), height, cloudViewer::visualization::gui::Widget::NONE, cloudViewer::visualization::gui::Widget::REDRAW, result, x, and y.

◆ GetCanSelectItemsWithChildren()

bool cloudViewer::visualization::gui::TreeView::GetCanSelectItemsWithChildren ( ) const

◆ GetItem()

std::shared_ptr< Widget > cloudViewer::visualization::gui::TreeView::GetItem ( ItemId  item_id) const

Returns item, or nullptr if item_id cannot be found.

◆ GetItemChildren()

std::vector< TreeView::ItemId > cloudViewer::visualization::gui::TreeView::GetItemChildren ( ItemId  parent_id) const

◆ GetRootItem()

TreeView::ItemId cloudViewer::visualization::gui::TreeView::GetRootItem ( ) const

Returns the ID of the root item, that is, AddItem(GetRootItem(), ...) will be a top-level item.

◆ GetSelectedItemId()

TreeView::ItemId cloudViewer::visualization::gui::TreeView::GetSelectedItemId ( ) const

Returns the currently selected item id in the tree.

◆ Layout()

void cloudViewer::visualization::gui::TreeView::Layout ( const LayoutContext &  context)
overridevirtual

◆ RemoveItem()

void cloudViewer::visualization::gui::TreeView::RemoveItem ( ItemId  item_id)

Removes an item an all its children (if any) from the tree.

◆ SetCanSelectItemsWithChildren()

void cloudViewer::visualization::gui::TreeView::SetCanSelectItemsWithChildren ( bool  can_select)

If true, enables selecting items that have children. Items can be toggled open/closed with the triangles or by double-clicking. Default is false.

◆ SetOnSelectionChanged()

void cloudViewer::visualization::gui::TreeView::SetOnSelectionChanged ( std::function< void(ItemId)>  on_selection_changed)

Calls onSelectionChanged(const char *sel_text, ItemId sel_item_id) when the list selection changes because of user action.

◆ SetSelectedItemId()

void cloudViewer::visualization::gui::TreeView::SetSelectedItemId ( ItemId  item_id)

Selects the indicated item of the list. Does not call onValueChanged.


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