Class Tree
- Namespace
- Forma
- Assembly
- Forma.dll
Hierarchical, column-oriented selection control modeled after Godot's Tree.
[TemplatePart("PART_TreePresenter", typeof(Container), true)]
public sealed class Tree : TemplatedControl, IAddChild<Control>, IAddChild, INotifyPropertyChanged, IDisposable
- Inheritance
-
Tree
- Implements
- Inherited Members
Constructors
Tree()
public Tree()
Fields
DropSectionNotFound
Godot's sentinel returned when no drop target exists.
public const int DropSectionNotFound = -100
Field Value
TreePresenterPartName
public const string TreePresenterPartName = "PART_TreePresenter"
Field Value
Properties
AccessibilityRole
public override AccessibilityRole AccessibilityRole { get; }
Property Value
AllowMultiSelect
Legacy convenience alias for SelectMode set to Multi.
public bool AllowMultiSelect { get; set; }
Property Value
AllowReselect
public bool AllowReselect { get; set; }
Property Value
AllowRightMouseSelect
Allows a right pointer press to select an item, matching Godot's allow_rmb_select. Disabled by default.
public bool AllowRightMouseSelect { get; set; }
Property Value
AllowSearch
Enables Godot-style case-insensitive incremental text search for focused tree items.
public bool AllowSearch { get; set; }
Property Value
AutoTooltipEnabled
Uses a cell's text as its tooltip when no explicit cell tooltip is set, matching Godot's set_auto_tooltip().
public bool AutoTooltipEnabled { get; }
Property Value
CanDropDataProvider
Application drop-acceptance hook corresponding to Godot's overridable _can_drop_data().
public Func<Tree, TreeItem, int, Point, object, bool> CanDropDataProvider { get; set; }
Property Value
ColumnResizeEnabled
Enables pointer resizing of visible column-header dividers.
public bool ColumnResizeEnabled { get; set; }
Property Value
ColumnResizeHandleWidth
Screen-space tolerance around a column divider that starts resize capture.
public int ColumnResizeHandleWidth { get; set; }
Property Value
ColumnTitlesVisible
public bool ColumnTitlesVisible { get; set; }
Property Value
Columns
public int Columns { get; set; }
Property Value
DragAutoScrollBorder
Width in pixels of the top and bottom drag-edge zones.
public int DragAutoScrollBorder { get; set; }
Property Value
DragAutoScrollEnabled
Enables vertical edge scrolling while a retained drag is active, corresponding to Godot Tree's themed drag-scroll behavior.
public bool DragAutoScrollEnabled { get; set; }
Property Value
DragAutoScrollSpeed
Maximum vertical auto-scroll speed in pixels per second at an edge.
public float DragAutoScrollSpeed { get; set; }
Property Value
DragDataProvider
Application drag-payload hook corresponding to Godot's overridable _get_drag_data(). It receives the hit item and column, which can be null and -1.
public Func<Tree, TreeItem, int, Point, object> DragDataProvider { get; set; }
Property Value
DragUnfoldDelay
Delay before a collapsed drag target unfolds. Godot's themed default is 500 ms.
public TimeSpan DragUnfoldDelay { get; set; }
Property Value
DragUnfoldingEnabled
Enables delayed expansion when a same-tree drag hovers a collapsed item, matching Godot's drag-unfold policy.
public bool DragUnfoldingEnabled { get; }
Property Value
DropDataHandler
Application drop-delivery hook corresponding to Godot's overridable _drop_data().
public Action<Tree, TreeItem, int, Point, object> DropDataHandler { get; set; }
Property Value
DropModeFlags
Enables item and/or in-between regions returned by GetDropSectionAtPosition(Point).
public TreeDropModeFlags DropModeFlags { get; set; }
Property Value
EditCheckboxCellOnlyWhenCheckboxPressed
Allows checkbox cell edits only when the checkbox glyph itself is pressed, matching Godot's checkbox edit policy.
public bool EditCheckboxCellOnlyWhenCheckboxPressed { get; }
Property Value
FoldingHidden
Hides folding arrows and disables their pointer toggle region, matching Godot's set_hide_folding().
public bool FoldingHidden { get; }
Property Value
Font
public SpriteFont Font { get; set; }
Property Value
- SpriteFont
HideRoot
public bool HideRoot { get; set; }
Property Value
HorizontalScrollEnabled
Enables Tree horizontal scrolling, matching Godot's set_h_scroll_enabled().
public bool HorizontalScrollEnabled { get; }
Property Value
IncrementalSearchText
public string IncrementalSearchText { get; }
Property Value
IncrementalSearchTimeout
Maximum interval between typed characters that belong to the same incremental search.
public TimeSpan IncrementalSearchTimeout { get; set; }
Property Value
Indent
public float Indent { get; set; }
Property Value
IsHorizontalScrollBarVisible
Whether the retained horizontal scrollbar is currently visible for overflowing Tree columns.
public bool IsHorizontalScrollBarVisible { get; }
Property Value
IsTouchDragDecelerating
public bool IsTouchDragDecelerating { get; }
Property Value
IsTouchDragging
public bool IsTouchDragging { get; }
Property Value
IsVerticalScrollBarVisible
Whether the retained vertical scrollbar is currently visible for overflowing Tree rows.
public bool IsVerticalScrollBarVisible { get; }
Property Value
ItemHeight
public float ItemHeight { get; set; }
Property Value
RangeStepRepeatDelay
Initial hold duration before an editable numeric range stepper repeats, matching Godot's 600 ms default.
public TimeSpan RangeStepRepeatDelay { get; set; }
Property Value
RangeStepRepeatInterval
Repeat cadence for a held numeric range stepper, matching Godot's 50 ms default.
public TimeSpan RangeStepRepeatInterval { get; set; }
Property Value
RecursiveFoldingEnabled
Allows Shift-clicking a folding arrow to collapse or expand every descendant, matching Godot's recursive folding policy.
public bool RecursiveFoldingEnabled { get; }
Property Value
RootItems
public IReadOnlyList<TreeItem> RootItems { get; }
Property Value
ScrollHintHeight
Height in pixels of each retained top or bottom scroll hint.
public int ScrollHintHeight { get; set; }
Property Value
ScrollHintMode
Configures Godot-style top/bottom overflow indicators.
public TreeScrollHintMode ScrollHintMode { get; }
Property Value
SelectMode
Configures single-cell, full-row, or multi-cell selection, matching Godot's select_mode.
public TreeSelectMode SelectMode { get; set; }
Property Value
SelectedColumn
public int SelectedColumn { get; }
Property Value
SelectedItem
public TreeItem SelectedItem { get; }
Property Value
SelfDragDropEnabled
Enables retained same-tree drag reparenting. Godot applications commonly provide their own payload policy through the Control drag/drop virtuals, so this is opt-in.
public bool SelfDragDropEnabled { get; set; }
Property Value
TileScrollHint
Retains Godot's texture tiling policy for themed scroll hints. The default retained solid hint does not tile.
public bool TileScrollHint { get; }
Property Value
TouchDragSpeed
public float TouchDragSpeed { get; }
Property Value
UIFont
public UIFont UIFont { get; set; }
Property Value
VerticalScrollEnabled
Enables Tree vertical scrolling, matching Godot's set_v_scroll_enabled().
public bool VerticalScrollEnabled { get; }
Property Value
Methods
AreColumnTitlesVisible()
public bool AreColumnTitlesVisible()
Returns
ArrangeChildren()
protected override void ArrangeChildren()
BeginTouchDragScroll()
Begins a retained vertical touch drag, mirroring Godot's touchscreen mouse-press handling in Tree::gui_input.
public void BeginTouchDragScroll()
CanDropData(Point, object)
Returns whether this control accepts the supplied data at the screen position.
public override bool CanDropData(Point position, object data)
Parameters
positionPointdataobject
Returns
CancelTouchDragScroll()
Cancels an in-progress touch drag immediately, mirroring Godot's Tree release/cleanup paths.
public void CancelTouchDragScroll()
Clear()
public void Clear()
ClearIncrementalSearch()
Clears the current incremental search prefix.
public void ClearIncrementalSearch()
CreateItem(TreeItem, int)
public TreeItem CreateItem(TreeItem parent = null, int index = -1)
Parameters
Returns
DeselectAll()
Clears every selected cell and navigation cursor, matching Godot's deselect_all().
public void DeselectAll()
DropData(Point, object)
Receives data accepted by CanDropData(Point, object).
public override void DropData(Point position, object data)
Parameters
positionPointdataobject
EditSelected(bool)
Opens the selected editable cell for application-provided editing, matching Godot's edit_selected().
public bool EditSelected(bool forceEdit = false)
Parameters
forceEditbool
Returns
EndTouchDragScroll()
Ends a retained touch drag, entering inertial deceleration when speed is nonzero like Godot's release handling.
public void EndTouchDragScroll()
EnsureCursorIsVisible()
Reveals the active selection cursor, matching Godot's ensure_cursor_is_visible().
public void EnsureCursorIsVisible()
GetButtonIdAtPosition(Point)
Returns the action-button ID at a screen position, or -1 when the position does not hit a visible action button.
public int GetButtonIdAtPosition(Point position)
Parameters
positionPoint
Returns
GetColumnAtPosition(Point)
Returns the column of the visible item at a screen position, or -1 when none is present.
public int GetColumnAtPosition(Point position)
Parameters
positionPoint
Returns
GetColumnExpandRatio(int)
public int GetColumnExpandRatio(int column)
Parameters
columnint
Returns
GetColumnMinimumWidth(int)
public int GetColumnMinimumWidth(int column)
Parameters
columnint
Returns
GetColumnTitle(int)
public string GetColumnTitle(int column)
Parameters
columnint
Returns
GetColumnTitleAlignment(int)
public HorizontalAlignment GetColumnTitleAlignment(int column)
Parameters
columnint
Returns
GetColumnTitleDirection(int)
public TextDirection GetColumnTitleDirection(int column)
Parameters
columnint
Returns
GetColumnTitleLanguage(int)
public string GetColumnTitleLanguage(int column)
Parameters
columnint
Returns
GetColumnTitleTooltipText(int)
public string GetColumnTitleTooltipText(int column)
Parameters
columnint
Returns
GetColumnWidth(int)
Returns the current rendered width of a column, matching Godot's get_column_width().
public int GetColumnWidth(int column)
Parameters
columnint
Returns
GetCustomPopupRect()
Returns the edited custom cell's rectangle for application popup placement, matching Godot's get_custom_popup_rect().
public Rectangle GetCustomPopupRect()
Returns
- Rectangle
GetDragData(Point)
Returns data to drag, or null to decline starting a drag.
public override object GetDragData(Point position)
Parameters
positionPoint
Returns
GetDropSectionAtPosition(Point)
Returns Godot's drop section (-1 before, 0 on, 1 after, 2 as first child), or DropSectionNotFound.
public int GetDropSectionAtPosition(Point position)
Parameters
positionPoint
Returns
GetEdited()
Returns the cell currently opened for editing, matching Godot's get_edited().
public TreeItem GetEdited()
Returns
GetEditedColumn()
public int GetEditedColumn()
Returns
GetHScrollBar()
Returns the retained horizontal scrollbar, matching Godot's get_h_scroll_bar().
public HScrollBar GetHScrollBar()
Returns
GetItemAreaRectangle(TreeItem, int, int)
Returns the on-screen rectangle for an item's cell or a cell action button.
public Rectangle GetItemAreaRectangle(TreeItem item, int column = -1, int button = -1)
Parameters
Returns
- Rectangle
GetItemAtPosition(Point)
Returns the visible item at a screen position, matching Godot's get_item_at_position().
public TreeItem GetItemAtPosition(Point position)
Parameters
positionPoint
Returns
GetItemOffset(TreeItem)
Returns an item's unscrolled top offset inside the retained Tree, or zero when it is not reachable in the expanded hierarchy.
public int GetItemOffset(TreeItem item)
Parameters
itemTreeItem
Returns
GetItemWithMetadata(object, int)
Finds the first item in tree order with matching cell metadata, matching Godot's get_item_with_metadata().
public TreeItem GetItemWithMetadata(object metadata, int column = -1)
Parameters
Returns
GetItemWithText(string)
Finds the first visible item with exactly matching text in any column, matching Godot's get_item_with_text().
public TreeItem GetItemWithText(string text)
Parameters
textstring
Returns
GetLastItem()
Returns the deepest final child of the root while it remains expanded, matching Godot's get_last_item().
public TreeItem GetLastItem()
Returns
GetNextSelected(TreeItem)
Returns the next selected item in complete tree order after from, matching Godot's get_next_selected().
public TreeItem GetNextSelected(TreeItem from = null)
Parameters
fromTreeItem
Returns
GetNextVisible(TreeItem, bool)
Returns the next rendered tree item after item.
public TreeItem GetNextVisible(TreeItem item, bool wrap = false)
Parameters
Returns
GetPressedButton()
Returns the index of the action button held by the current pointer gesture, or -1.
public int GetPressedButton()
Returns
GetRangeEditorLineEdit()
Returns the numeric text entry owned by GetRangeEditorPopup().
public LineEdit GetRangeEditorLineEdit()
Returns
GetRangeEditorPopup()
Returns the retained inline editor used by editable numeric range cells.
public PopupPanel GetRangeEditorPopup()
Returns
GetRangeEditorSlider()
Returns the slider synchronized with GetRangeEditorLineEdit().
public HSlider GetRangeEditorSlider()
Returns
GetRangePopup()
Returns the retained option menu used by editable labeled range cells.
public PopupMenu GetRangePopup()
Returns
Remarks
Godot owns this popup internally; exposing it here permits host styling and deterministic inspection.
GetRoot()
Returns the first root item, matching Godot's get_root().
public TreeItem GetRoot()
Returns
GetScroll()
Returns the retained scroll position, matching Godot's get_scroll().
public Vector2 GetScroll()
Returns
- Vector2
GetScrollHintMode()
public TreeScrollHintMode GetScrollHintMode()
Returns
GetSelectMode()
public TreeSelectMode GetSelectMode()
Returns
GetSelected()
public TreeItem GetSelected()
Returns
GetSelectedColumn()
public int GetSelectedColumn()
Returns
GetStringEditorLineEdit()
Returns the single-line editor used for a Tree string cell without edit_multiline.
public LineEdit GetStringEditorLineEdit()
Returns
GetStringEditorPopup()
Returns the popup that hosts editable string Tree cells.
public PopupPanel GetStringEditorPopup()
Returns
GetStringEditorTextEdit()
Returns the multiline editor used for a Tree string cell with edit_multiline.
public TextEdit GetStringEditorTextEdit()
Returns
GetTooltip(Point)
Returns the tooltip at a global pointer position. Override to provide dynamic help text.
public override string GetTooltip(Point position)
Parameters
positionPoint
Returns
GetVScrollBar()
Returns the retained vertical scrollbar, matching Godot's get_v_scroll_bar().
public VScrollBar GetVScrollBar()
Returns
IsAnythingSelected()
Returns whether the Tree has a selection cursor, matching Godot's is_anything_selected().
public bool IsAnythingSelected()
Returns
IsAutoTooltipEnabled()
public bool IsAutoTooltipEnabled()
Returns
IsColumnClippingContent(int)
public bool IsColumnClippingContent(int column)
Parameters
columnint
Returns
IsColumnExpanding(int)
public bool IsColumnExpanding(int column)
Parameters
columnint
Returns
IsDragUnfoldingEnabled()
public bool IsDragUnfoldingEnabled()
Returns
IsEditCheckboxCellOnlyWhenCheckboxPressed()
public bool IsEditCheckboxCellOnlyWhenCheckboxPressed()
Returns
IsEditing()
public bool IsEditing()
Returns
IsFoldingHidden()
public bool IsFoldingHidden()
Returns
IsHorizontalScrollEnabled()
public bool IsHorizontalScrollEnabled()
Returns
IsRecursiveFoldingEnabled()
public bool IsRecursiveFoldingEnabled()
Returns
IsRootHidden()
public bool IsRootHidden()
Returns
IsScrollHintTiled()
public bool IsScrollHintTiled()
Returns
IsVerticalScrollEnabled()
public bool IsVerticalScrollEnabled()
Returns
OnTemplateApplied()
protected override void OnTemplateApplied()
ScrollToItem(TreeItem, bool)
Scrolls as little as necessary to reveal an item, matching Godot's scroll_to_item().
public void ScrollToItem(TreeItem item, bool centerOnItem = false)
Parameters
SearchItemText(string, out int, bool)
Finds the next visible item whose cell starts with text, wrapping from the active selection as Godot's search_item_text() does.
public TreeItem SearchItemText(string text, out int column, bool selectable = false)
Parameters
Returns
Select(TreeItem, int, bool)
public void Select(TreeItem item, int column = 0, bool emit = true)
Parameters
SetAutoTooltip(bool)
public void SetAutoTooltip(bool enabled)
Parameters
enabledbool
SetColumnClipContent(int, bool)
Clips icons, text, buttons, and custom drawing to a column's cell bounds, matching Godot's set_column_clip_content().
public void SetColumnClipContent(int column, bool clip)
Parameters
SetColumnCustomMinimumWidth(int, int)
public void SetColumnCustomMinimumWidth(int column, int minimumWidth)
Parameters
SetColumnExpand(int, bool)
public void SetColumnExpand(int column, bool expand)
Parameters
SetColumnExpandRatio(int, int)
public void SetColumnExpandRatio(int column, int ratio)
Parameters
SetColumnTitle(int, string)
public void SetColumnTitle(int column, string title)
Parameters
SetColumnTitleAlignment(int, HorizontalAlignment)
public void SetColumnTitleAlignment(int column, HorizontalAlignment alignment)
Parameters
columnintalignmentHorizontalAlignment
SetColumnTitleDirection(int, TextDirection)
Sets the shaping direction for a column title, matching Godot's set_column_title_direction().
public void SetColumnTitleDirection(int column, TextDirection direction)
Parameters
columnintdirectionTextDirection
Remarks
Direction is retained for the text renderer. The default SpriteFont renderer does not yet provide Godot's Unicode/bidi shaping behavior.
SetColumnTitleLanguage(int, string)
Sets the BCP-47 language hint for a column title, matching Godot's set_column_title_language().
public void SetColumnTitleLanguage(int column, string language)
Parameters
Remarks
The hint is retained for shaped-text capable renderers; the default SpriteFont renderer does not yet use language-specific shaping.
SetColumnTitleTooltipText(int, string)
public void SetColumnTitleTooltipText(int column, string tooltip)
Parameters
SetColumnTitlesVisible(bool)
public void SetColumnTitlesVisible(bool visible)
Parameters
visiblebool
SetEditCheckboxCellOnlyWhenCheckboxPressed(bool)
public void SetEditCheckboxCellOnlyWhenCheckboxPressed(bool enabled)
Parameters
enabledbool
SetEnableDragUnfolding(bool)
public void SetEnableDragUnfolding(bool enabled)
Parameters
enabledbool
SetEnableRecursiveFolding(bool)
public void SetEnableRecursiveFolding(bool enabled)
Parameters
enabledbool
SetHideFolding(bool)
public void SetHideFolding(bool hidden)
Parameters
hiddenbool
SetHideRoot(bool)
public void SetHideRoot(bool hidden)
Parameters
hiddenbool
SetHorizontalScrollEnabled(bool)
public void SetHorizontalScrollEnabled(bool enabled)
Parameters
enabledbool
SetScrollHintMode(TreeScrollHintMode)
public void SetScrollHintMode(TreeScrollHintMode mode)
Parameters
modeTreeScrollHintMode
SetSelectMode(TreeSelectMode)
public void SetSelectMode(TreeSelectMode mode)
Parameters
modeTreeSelectMode
SetSelected(TreeItem, int)
Compatibility method for Godot's set_selected(); it replaces the existing selection.
public void SetSelected(TreeItem item, int column = 0)
Parameters
SetTileScrollHint(bool)
public void SetTileScrollHint(bool enabled)
Parameters
enabledbool
SetVerticalScrollEnabled(bool)
public void SetVerticalScrollEnabled(bool enabled)
Parameters
enabledbool
TouchDragScrollBy(float, float)
Applies relative vertical touch motion and its instantaneous velocity, mirroring Godot's gui_input drag accumulation.
public void TouchDragScrollBy(float relativeMotion, float velocity)
Parameters
Events
ButtonClicked
Raised when an enabled TreeItem action button is clicked. Arguments are item, column, and button id.
public event Action<Tree, TreeItem, int, int> ButtonClicked
Event Type
CellSelected
public event Action<Tree, TreeItem, int> CellSelected
Event Type
CheckPropagatedToItem
Raised for each item affected by PropagateCheck(int, bool), matching Godot's check_propagated_to_item signal.
public event Action<Tree, TreeItem, int> CheckPropagatedToItem
Event Type
ColumnResized
Raised after an interactive column-header resize changes the retained minimum width.
public event Action<Tree, int, int> ColumnResized
Event Type
ColumnTitleClicked
Raised on left or right release over a visible column title, corresponding to Godot's column_title_clicked(column, mouse_button_index) signal.
public event Action<Tree, int, PointerButton> ColumnTitleClicked
Event Type
CustomPopupEdited
Raised when a custom cell requests an application popup, matching Godot's custom_popup_edited signal. Query the edited-cell methods for context.
public event Action<Tree, bool> CustomPopupEdited
Event Type
ItemActivated
public event Action<Tree, TreeItem> ItemActivated
Event Type
ItemCollapsed
public event Action<Tree, TreeItem> ItemCollapsed
Event Type
ItemDropped
Raised after an opt-in same-tree drag successfully changes hierarchy. Arguments are dragged item, target item, and drop section.
public event Action<Tree, TreeItem, TreeItem, int> ItemDropped
Event Type
ItemEdited
public event Action<Tree, TreeItem, int> ItemEdited
Event Type
ItemMouseSelected
Raised when item selection is initiated with a pointer button, corresponding to Godot's item_mouse_selected(mouse_position, mouse_button_index) signal.
public event Action<Tree, Point, PointerButton> ItemMouseSelected
Event Type
- Action<Tree, Point, PointerButton>
ItemSelected
public event Action<Tree, TreeItem> ItemSelected
Event Type
MultiSelected
Raised when a cell is selected or deselected in multi-select mode. The final argument is the new selected state.
public event Action<Tree, TreeItem, int, bool> MultiSelected