![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <TreeView.h>
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 () |
| cloudViewer::visualization::gui::TreeView::TreeView | ( | ) |
| cloudViewer::visualization::gui::TreeView::~TreeView | ( | ) |
| TreeView::ItemId cloudViewer::visualization::gui::TreeView::AddItem | ( | ItemId | parent_id, |
| std::shared_ptr< Widget > | item | ||
| ) |
Adds an item to the tree.
References cloudViewer::visualization::gui::TreeView::Impl::Item::cell, cloudViewer::visualization::gui::TreeView::Impl::Item::children, cloudViewer::visualization::gui::TreeView::Impl::g_next_id, cloudViewer::visualization::gui::TreeView::Impl::Item::id, cloudViewer::visualization::gui::TreeView::Impl::Item::id_string, and cloudViewer::visualization::gui::TreeView::Impl::Item::parent.
Referenced by AddTextItem().
| TreeView::ItemId cloudViewer::visualization::gui::TreeView::AddTextItem | ( | ItemId | parent_id, |
| const char * | text | ||
| ) |
Adds a text item to the tree.
References AddItem().
|
overridevirtual |
Reimplemented from cloudViewer::visualization::gui::Widget.
References context.
|
overridevirtual |
Reimplemented from cloudViewer::visualization::gui::Widget.
References cloudViewer::visualization::gui::Widget::DIM_GROW, and cloudViewer::visualization::gui::Widget::Constraints::width.
| void cloudViewer::visualization::gui::TreeView::Clear | ( | ) |
Clears all the items.
|
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.
| bool cloudViewer::visualization::gui::TreeView::GetCanSelectItemsWithChildren | ( | ) | const |
| std::shared_ptr< Widget > cloudViewer::visualization::gui::TreeView::GetItem | ( | ItemId | item_id | ) | const |
Returns item, or nullptr if item_id cannot be found.
| std::vector< TreeView::ItemId > cloudViewer::visualization::gui::TreeView::GetItemChildren | ( | ItemId | parent_id | ) | const |
| 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.
| TreeView::ItemId cloudViewer::visualization::gui::TreeView::GetSelectedItemId | ( | ) | const |
Returns the currently selected item id in the tree.
|
overridevirtual |
Reimplemented from cloudViewer::visualization::gui::Widget.
| void cloudViewer::visualization::gui::TreeView::RemoveItem | ( | ItemId | item_id | ) |
Removes an item an all its children (if any) from the tree.
| 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.
| 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.
| void cloudViewer::visualization::gui::TreeView::SetSelectedItemId | ( | ItemId | item_id | ) |
Selects the indicated item of the list. Does not call onValueChanged.