ATreeView
- Module
- Arc
- Header
#include "Arc/Widgets/ATreeView.h"- Namespace
Arcf- Template
template<typename ItemType>
Type aliases
| Alias | Description |
|---|---|
using COnGenerateRow = std::function<TSharedPtr<AWidget>(const ItemType&, uint32_t )> | |
using COnRefreshRow = std::function<void(const TSharedPtr<AWidget>& , const ItemType&, uint32_t )> | |
using COnGetChildren = std::function<void(const ItemType& , std::vector<ItemType>& )> | |
using COnSelectionChanged = ArcDelegate<void(const ItemType& )> | |
using CItemHasher = std::function<size_t(const ItemType&)> | |
using COnCanAcceptDrop = std::function<bool(const ItemType& , const ItemType& )> | |
using COnHasChildren = std::function<bool(const ItemType&)> | Optional: answers "does this item have children" without building the child list. Without it a rebuild asks OnGetChildren for every collapsed row too, only to decide whether to draw a chevron. |
Properties
| Type | Name | Description |
|---|---|---|
COnSelectionChanged | OnSelectionChanged | |
ArcDelegate<void()> | OnSelectionCleared | |
ArcDelegate<void(const ItemType& , const ItemType& )> | OnItemDropped | Drag-to-reorder/reparent. A row drag begins once the cursor moves past the threshold with the button held; OnItemDropped fires for a drop onto another row, OnItemDroppedOnVoid for a drop on the empty area below the last row. No delegates bound = no drag behavior. |
ArcDelegate<void(const ItemType& )> | OnItemDroppedOnVoid | |
COnSelectionChanged | OnItemRenameRequested | F2 on the selected row (rename in place). |
Public functions
| Returns | Name | Description |
|---|---|---|
ARC_WIDGET_ARGS | ||
void | SetLeadingWidth | Leading columns: a strip this wide at the left of every row that does not indent with depth (the outliner's eye and lock). |
float | GetLeadingWidth | |
float | RowContentIndent | Where a row's label starts, measured from the row's own left edge, when leading columns are on. |
void | SetEmptyText | Contextual empty-state line ("no actors", "nothing matches") — settable at runtime so filters can explain themselves. |
void | SetEmptyWidget | What the tree shows, filling it, while it has no rows: an AEmptyState or a panel's own hint. |
TSharedPtr<AWidget> | GetEmptyWidget | |
void | SetEmptyWidgetRows | The empty widget also shows under this many rows, filling the space below them: a level whose only row is the level itself. |
bool | IsShowingEmptyWidget | Whether the empty widget is the tree's content right now. |
void | SetRootItems | |
void | SetOnGenerateRow | |
void | SetOnRefreshRow | Row recycling, as in AListView: with this bound, a row leaving the window (or orphaned by a rebuilt flat list) goes to a pool, and the next row needed is re-pointed at its item instead of built. |
uint64_t | GetRowsGenerated | Rows built by OnGenerateRow / re-pointed by OnRefreshRow so far. |
uint64_t | GetRowsRefreshed | |
void | SetOnGetChildren | |
void | SetCanAcceptDrop | |
void | SetSelectedIndex | |
void | SetSelectedItems | Replaces the whole selection set; primary marks the row that gets the strong selected treatment (all others use the secondary color). |
void | GetSelectedItems | Selected items in visible (flattened tree) order. |
void | ClearSelection | |
bool | IsItemSelected | |
bool | IsItemPrimary | |
void | SetSelectionRowColors | Optional row-color overrides. |
void | SetDropTargetRowColors | |
int32_t | GetSelectionCount | |
int32_t | IndexAtPosition | Row index under an absolute point, or -1 for the empty area below the last row and for points outside the tree. |
bool | GetItemAtIndex | |
ArcRect | GetRowAbsoluteRect | |
int32_t | GetRowCount | |
void | SetExternalDropTarget | Drop feedback driven from outside the tree (a drag that started in another panel). |
void | ClearExternalDropTarget | |
int32_t | GetExternalDropIndex | |
int32_t | FindItemIndex | |
void | SetExpanded | |
void | BeginBatchUpdate | Every rebuild walks the whole visible tree. |
void | EndBatchUpdate | |
void | SetOnHasChildren | |
uint64_t | GetFlatRebuildCount | |
uint64_t | GetChildQueryCount | |
bool | IsExpanded | |
void | ToggleExpansion | |
ArcVec2 | ComputeDesiredSize | |
bool | CanCacheDesiredSize | A constant. |
bool | DesiredSizeDependsOnChildren | |
bool | CanSkipArrange | Refused for the same reason as AListView: row recycling and scroll clamping live in the arrange body. |
bool | CanRetainPaint | Refused for the same reason: recycled rows and a selection that moves with nothing to invalidate on. |
void | ArrangeChildren | |
int32_t | OnPaint | tree-row.json: rows are 4 px-radius pills across the tree, hover SurfaceHover, pressed Surface4, selected Selection, the keyboard row a 1 px FocusRing inset, the 12 px Lucide chevron in a 12 px slot at 4 px + 16 px per level, and a hidden or disabled row in TextDisabled. |
CReply | OnMouseWheel | |
CReply | OnMouseButtonDown | |
CReply | OnKeyDown | Keyboard model (U1): Up/Down walk the visible rows, Left collapses (or jumps to the parent), Right expands, Home/End jump, Enter re-broadcasts the selection as an activation. |
CReply | OnMouseButtonUp | |
CReply | OnMouseMove | |
void | OnMouseLeave | |
void | OnMouseCaptureLost | |
EArcCursorType | OnCursorQuery | |
int32_t | GetNumChildren | |
TSharedPtr<AWidget> | GetChildAt | |
const char* | GetTypeName | |
bool | IsFocusable | |
EFocusVisual | GetFocusVisual | The keyboard row carries tree-row.json's inset ring, not the tree. |
bool | PaintsOwnFocus | |
void | SetOnIsItemDimmed | Rows this answers true for paint in the Disabled state: the outliner's hidden actors (eye-off) read as TextDisabled. |
Function details
ARC_WIDGET_ARGS
ARC_WIDGET_ARGS(ATreeView) ARC_ARG(float, ItemHeight) ARC_ARG(float, IndentStep) ARC_ARG(float, ChevronWidth) ARC_ARG(float, RowPaddingX) ARC_ARG(float, LeadingWidth) ARC_ARG(bool, OverlayScrollbar) ARC_ARG(CText, EmptyText) ARC_WIDGET_ARGS_END() void Construct(const CArguments& args)SetLeadingWidth
void SetLeadingWidth(float width)Leading columns: a strip this wide at the left of every row that does not indent with depth (the outliner's eye and lock). With it set, each row is arranged across the whole row width and the chevron and indent start after the strip, so the row lays its own label out at RowContentIndent(depth).
GetLeadingWidth
float GetLeadingWidth() constRowContentIndent
float RowContentIndent(uint32_t depth) constWhere a row's label starts, measured from the row's own left edge, when leading columns are on.
SetEmptyText
void SetEmptyText(const CText& text)Contextual empty-state line ("no actors", "nothing matches") — settable at runtime so filters can explain themselves.
SetEmptyWidget
void SetEmptyWidget(TSharedPtr<AWidget> widget)What the tree shows, filling it, while it has no rows: an AEmptyState or a panel's own hint. Takes the empty text's place.
GetEmptyWidget
TSharedPtr<AWidget> GetEmptyWidget() constSetEmptyWidgetRows
void SetEmptyWidgetRows(int32_t rows)The empty widget also shows under this many rows, filling the space below them: a level whose only row is the level itself.
IsShowingEmptyWidget
bool IsShowingEmptyWidget() constWhether the empty widget is the tree's content right now.
SetRootItems
void SetRootItems(const std::vector<ItemType>& roots)SetOnGenerateRow
void SetOnGenerateRow(COnGenerateRow func)SetOnRefreshRow
void SetOnRefreshRow(COnRefreshRow func)Row recycling, as in AListView: with this bound, a row leaving the window (or orphaned by a rebuilt flat list) goes to a pool, and the next row needed is re-pointed at its item instead of built. The callback must leave the row exactly what OnGenerateRow would have built for that item and depth.
GetRowsGenerated
uint64_t GetRowsGenerated() constRows built by OnGenerateRow / re-pointed by OnRefreshRow so far.
GetRowsRefreshed
uint64_t GetRowsRefreshed() constSetOnGetChildren
void SetOnGetChildren(COnGetChildren func)SetCanAcceptDrop
void SetCanAcceptDrop(COnCanAcceptDrop func)SetSelectedIndex
void SetSelectedIndex(int32_t idx)SetSelectedItems
void SetSelectedItems(const std::vector<ItemType>& items, const ItemType& primary)Replaces the whole selection set; primary marks the row that gets the strong selected treatment (all others use the secondary color).
GetSelectedItems
void GetSelectedItems(std::vector<ItemType>& outItems) constSelected items in visible (flattened tree) order.
ClearSelection
void ClearSelection()IsItemSelected
bool IsItemSelected(const ItemType& item) constIsItemPrimary
bool IsItemPrimary(const ItemType& item) constSetSelectionRowColors
void SetSelectionRowColors(const ArcColor& primary, const ArcColor& secondary)Optional row-color overrides. When unset, the active style set's TableRowStyle.SelectedColor paints every selected row.
SetDropTargetRowColors
void SetDropTargetRowColors(const ArcColor& background, const ArcColor& border)GetSelectionCount
int32_t GetSelectionCount() constIndexAtPosition
int32_t IndexAtPosition(const ArcVec2& absolutePosition) constRow index under an absolute point, or -1 for the empty area below the last row and for points outside the tree. External drop targets need this because the drag source owns the mouse for the whole gesture.
GetItemAtIndex
bool GetItemAtIndex(int32_t index, ItemType& outItem) constGetRowAbsoluteRect
ArcRect GetRowAbsoluteRect(int32_t index) constGetRowCount
int32_t GetRowCount() constSetExternalDropTarget
void SetExternalDropTarget(int32_t index, bool onVoid)Drop feedback driven from outside the tree (a drag that started in another panel). index >= 0 paints the drop-into treatment on that row; onVoid paints the insertion line under the last row.
ClearExternalDropTarget
void ClearExternalDropTarget()GetExternalDropIndex
int32_t GetExternalDropIndex() constFindItemIndex
int32_t FindItemIndex(const ItemType& item) constSetExpanded
void SetExpanded(const ItemType& item, bool expanded)BeginBatchUpdate
void BeginBatchUpdate()Every rebuild walks the whole visible tree. A caller that changes roots and many expansions at once (a filter refresh opening each ancestor of every hit) brackets the edits so the walk runs once at the end instead of once per SetExpanded — the Outliner on a large scene stalled on exactly that.
EndBatchUpdate
void EndBatchUpdate()SetOnHasChildren
void SetOnHasChildren(COnHasChildren func)GetFlatRebuildCount
uint64_t GetFlatRebuildCount() constGetChildQueryCount
uint64_t GetChildQueryCount() constIsExpanded
bool IsExpanded(const ItemType& item) constToggleExpansion
void ToggleExpansion(const ItemType& item)ComputeDesiredSize
ArcVec2 ComputeDesiredSize(float ) const overrideCanCacheDesiredSize
bool CanCacheDesiredSize() const overrideA constant. Rows are generated during arrange and never enter this widget's own measure, so scrolling, expansion and regeneration cannot move it.
DesiredSizeDependsOnChildren
bool DesiredSizeDependsOnChildren() const overrideCanSkipArrange
bool CanSkipArrange() const overrideRefused for the same reason as AListView: row recycling and scroll clamping live in the arrange body.
CanRetainPaint
bool CanRetainPaint() const overrideRefused for the same reason: recycled rows and a selection that moves with nothing to invalidate on.
ArrangeChildren
void ArrangeChildren(const CGeometry& allottedGeo) overrideOnPaint
int32_t OnPaint(const CArcPaintArgs& args, const CGeometry& geo, CArcUIRenderer& renderer, int32_t layerId) const overridetree-row.json: rows are 4 px-radius pills across the tree, hover SurfaceHover, pressed Surface4, selected Selection, the keyboard row a 1 px FocusRing inset, the 12 px Lucide chevron in a 12 px slot at 4 px + 16 px per level, and a hidden or disabled row in TextDisabled.
OnMouseWheel
CReply OnMouseWheel(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseButtonDown
CReply OnMouseButtonDown(const CGeometry& geo, const CPointerEvent& event) overrideOnKeyDown
CReply OnKeyDown(const CGeometry& geo, const CKeyEvent& event) overrideKeyboard model (U1): Up/Down walk the visible rows, Left collapses (or jumps to the parent), Right expands, Home/End jump, Enter re-broadcasts the selection as an activation.
OnMouseButtonUp
CReply OnMouseButtonUp(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseMove
CReply OnMouseMove(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseLeave
void OnMouseLeave(const CPointerEvent& event) overrideOnMouseCaptureLost
void OnMouseCaptureLost() overrideOnCursorQuery
EArcCursorType OnCursorQuery(const CGeometry& geo, const CPointerEvent& event) const overrideGetNumChildren
int32_t GetNumChildren() const overrideGetChildAt
TSharedPtr<AWidget> GetChildAt(int32_t index) const overrideGetTypeName
const char* GetTypeName() const overrideIsFocusable
bool IsFocusable() const overrideGetFocusVisual
EFocusVisual GetFocusVisual() const overrideThe keyboard row carries tree-row.json's inset ring, not the tree.
PaintsOwnFocus
bool PaintsOwnFocus() const overrideSetOnIsItemDimmed
void SetOnIsItemDimmed(std::function<bool(const ItemType&)> func)Rows this answers true for paint in the Disabled state: the outliner's hidden actors (eye-off) read as TextDisabled.