Skip to content

TabContainer

Eduard Gushchin edited this page Jul 1, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.TabContainer
Namespace Electron2D
Kind class
Category UI and Text

Overview

Displays direct child controls as selectable tab pages.

Syntax

public class Electron2D.TabContainer : Electron2D.Container

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: TabContainer

Runtime tab container that treats direct child controls as tab pages, stores titles/icons/disabled/hidden state, switches by pointer input and emits tab_changed.

Remarks

TabContainer is a runtime UI container. Each direct child Electron2D.Control becomes a tab page; non-control children remain in the node tree but are ignored by tab layout and tab metadata queries.

The 0.1.0 Preview implementation stores tab titles, icons, disabled state and hidden state, routes pointer presses on the tab header and fits the selected page into the remaining rectangle.

Thread Safety

This type is not synchronized. Create and mutate tab containers on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Container
  • Electron2D.Control

Members

Member Kind Summary
AllTabsInFront Property Gets or sets whether all tab buttons should be drawn in front.
CurrentTab Property Gets or sets the current selected tab index.
DeselectEnabled Property Gets or sets whether the container may have no selected tab.
TabAlignment Property Gets or sets tab button alignment inside the header.
TabsPosition Property Gets or sets the tab header position.
TabsVisible Property Gets or sets whether the tab header is visible.
UseHiddenTabsForMinSize Property Gets or sets whether hidden tabs contribute to minimum size.
Electron2D.TabContainer() Constructor Initializes a new instance of the Electron2D.TabContainer class.
GetCurrentTabControl() Method Gets the control displayed by the current tab.
GetPreviousTab() Method Gets the tab index that was selected before the current tab.
GetTabControl(System.Int32) Method Gets the control displayed by a tab.
GetTabCount() Method Gets the number of direct child controls treated as tabs.
GetTabIcon(System.Int32) Method Gets the icon displayed by a tab button.
GetTabIdxAtPoint(Electron2D.Vector2) Method Gets the tab index whose button contains a local point.
GetTabIdxFromControl(Electron2D.Control) Method Gets the tab index for a direct child control.
GetTabTitle(System.Int32) Method Gets the title displayed by a tab button.
IsTabDisabled(System.Int32) Method Reports whether a tab is disabled.
IsTabHidden(System.Int32) Method Reports whether a tab is hidden.
SelectNextAvailable() Method Selects the next available tab.
SelectPreviousAvailable() Method Selects the previous available tab.
SetTabDisabled(System.Int32, System.Boolean) Method Sets whether a tab is disabled.
SetTabHidden(System.Int32, System.Boolean) Method Sets whether a tab is hidden.
SetTabIcon(System.Int32, Electron2D.Texture2D) Method Sets the icon displayed by a tab button.
SetTabTitle(System.Int32, System.String) Method Sets the title displayed by a tab button.
_Draw() Method Draws the tab header and tab button labels.
_GetMinimumSize() Method Gets the minimum size requested by this tab container.
_GuiInput(Electron2D.InputEvent) Method Handles GUI input routed to this tab container.

Member Details

AllTabsInFront

Kind: Property

public System.Boolean AllTabsInFront { get; set; }

Summary

Gets or sets whether all tab buttons should be drawn in front.

Remarks

The preview stores this styling policy. Page visibility still follows Electron2D.TabContainer.CurrentTab.

Value

true to request all tabs in front; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer._Draw

CurrentTab

Kind: Property

public System.Int32 CurrentTab { get; set; }

Summary

Gets or sets the current selected tab index.

Remarks

Setting this property updates page visibility and emits tab_changed when the selected tab changes.

Disabled and hidden tabs are not selected. Assigning -1 is accepted only when Electron2D.TabContainer.DeselectEnabled is true.

Value

The current tab index, or -1 when no tab is selected.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the assigned index is outside the tab range.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.GetCurrentTabControl
  • Electron2D.TabContainer.GetPreviousTab

DeselectEnabled

Kind: Property

public System.Boolean DeselectEnabled { get; set; }

Summary

Gets or sets whether the container may have no selected tab.

Remarks

When this value is false, the container selects the first available tab whenever possible.

Value

true to allow Electron2D.TabContainer.CurrentTab to be -1; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.CurrentTab

TabAlignment

Kind: Property

public Electron2D.TabContainer.AlignmentModeEnum TabAlignment { get; set; }

Summary

Gets or sets tab button alignment inside the header.

Remarks

Changing alignment queues a redraw because tab button hit rectangles and drawing positions use the same calculation.

Value

The current Electron2D.TabContainer.AlignmentModeEnum. The default is Electron2D.TabContainer.AlignmentModeEnum.Left.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.GetTabIdxAtPoint(Electron2D.Vector2)

TabsPosition

Kind: Property

public Electron2D.TabContainer.TabPositionEnum TabsPosition { get; set; }

Summary

Gets or sets the tab header position.

Remarks

Changing this value queues a layout pass and redraw.

Value

The current Electron2D.TabContainer.TabPositionEnum. The default is Electron2D.TabContainer.TabPositionEnum.Top.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.TabsVisible

TabsVisible

Kind: Property

public System.Boolean TabsVisible { get; set; }

Summary

Gets or sets whether the tab header is visible.

Remarks

Hiding the header does not change the selected page.

Value

true to draw and hit-test the tab header; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.TabsPosition

UseHiddenTabsForMinSize

Kind: Property

public System.Boolean UseHiddenTabsForMinSize { get; set; }

Summary

Gets or sets whether hidden tabs contribute to minimum size.

Remarks

This setting affects Electron2D.TabContainer._GetMinimumSize only. Hidden tabs remain unavailable for selection.

Value

true to measure hidden tab pages; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.SetTabHidden(System.Int32,System.Boolean)

Electron2D.TabContainer()

Kind: Constructor

public Electron2D.TabContainer()

Summary

Initializes a new instance of the Electron2D.TabContainer class.

Remarks

The constructor registers the tab_changed signal and enables clipping so tab pages cannot draw outside the container rectangle.

Thread Safety

This constructor is not synchronized. Call it from the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer

GetCurrentTabControl()

Kind: Method

public Electron2D.Control GetCurrentTabControl()()

Summary

Gets the control displayed by the current tab.

Remarks

This method normalizes Electron2D.TabContainer.CurrentTab before returning the control.

Returns

The selected tab control, or null when no tab is selected.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.CurrentTab

GetPreviousTab()

Kind: Method

public System.Int32 GetPreviousTab()()

Summary

Gets the tab index that was selected before the current tab.

Remarks

The value is updated only when the selected tab changes.

Returns

The previous tab index, or -1 when there was no previous tab.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.CurrentTab

GetTabControl(System.Int32)

Kind: Method

public Electron2D.Control GetTabControl(System.Int32)(System.Int32 tabIndex)

Summary

Gets the control displayed by a tab.

Remarks

The returned control remains owned by the node tree. Removing or moving it changes subsequent tab indices.

Parameters

  • tabIndex: The zero-based tab index.

Returns

The direct child Electron2D.Control for the tab.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.GetCurrentTabControl

GetTabCount()

Kind: Method

public System.Int32 GetTabCount()()

Summary

Gets the number of direct child controls treated as tabs.

Remarks

Non-control children are ignored by this count.

Returns

The current tab count.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.GetTabControl(System.Int32)

GetTabIcon(System.Int32)

Kind: Method

public Electron2D.Texture2D GetTabIcon(System.Int32)(System.Int32 tabIndex)

Summary

Gets the icon displayed by a tab button.

Remarks

The returned texture is the same resource assigned by Electron2D.TabContainer.SetTabIcon(System.Int32,Electron2D.Texture2D).

Parameters

  • tabIndex: The zero-based tab index.

Returns

The icon texture, or null when no icon is assigned.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.SetTabIcon(System.Int32,Electron2D.Texture2D)

GetTabIdxAtPoint(Electron2D.Vector2)

Kind: Method

public System.Int32 GetTabIdxAtPoint(Electron2D.Vector2)(Electron2D.Vector2 point)

Summary

Gets the tab index whose button contains a local point.

Remarks

This method uses the same tab rectangles as pointer input. Hidden and disabled tabs are skipped.

Parameters

  • point: The local point inside this container.

Returns

The tab index at the point, or -1 when the point is not over an enabled visible tab button.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer._GuiInput(Electron2D.InputEvent)

GetTabIdxFromControl(Electron2D.Control)

Kind: Method

public System.Int32 GetTabIdxFromControl(Electron2D.Control)(Electron2D.Control control)

Summary

Gets the tab index for a direct child control.

Remarks

The method uses reference identity and does not search descendants.

Parameters

  • control: The direct child control to query.

Returns

The tab index, or -1 when control is not a tab.

Exceptions

  • System.ArgumentNullException: Thrown when control is null.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.GetTabControl(System.Int32)

GetTabTitle(System.Int32)

Kind: Method

public System.String GetTabTitle(System.Int32)(System.Int32 tabIndex)

Summary

Gets the title displayed by a tab button.

Remarks

The returned value is never null.

Parameters

  • tabIndex: The zero-based tab index.

Returns

The assigned tab title, or the child control name when no title was assigned.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.SetTabTitle(System.Int32,System.String)

IsTabDisabled(System.Int32)

Kind: Method

public System.Boolean IsTabDisabled(System.Int32)(System.Int32 tabIndex)

Summary

Reports whether a tab is disabled.

Remarks

Disabled tabs are still counted by Electron2D.TabContainer.GetTabCount.

Parameters

  • tabIndex: The zero-based tab index.

Returns

true when the tab is disabled; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.SetTabDisabled(System.Int32,System.Boolean)

IsTabHidden(System.Int32)

Kind: Method

public System.Boolean IsTabHidden(System.Int32)(System.Int32 tabIndex)

Summary

Reports whether a tab is hidden.

Remarks

Hidden tabs remain part of the child list and keep their metadata.

Parameters

  • tabIndex: The zero-based tab index.

Returns

true when the tab is hidden; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.SetTabHidden(System.Int32,System.Boolean)

SelectNextAvailable()

Kind: Method

public System.Boolean SelectNextAvailable()()

Summary

Selects the next available tab.

Remarks

Hidden and disabled tabs are skipped. This method does not wrap around to the beginning of the list.

Returns

true when a later available tab was selected; otherwise, false.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.SelectPreviousAvailable

SelectPreviousAvailable()

Kind: Method

public System.Boolean SelectPreviousAvailable()()

Summary

Selects the previous available tab.

Remarks

Hidden and disabled tabs are skipped. This method does not wrap around to the end of the list.

Returns

true when an earlier available tab was selected; otherwise, false.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.SelectNextAvailable

SetTabDisabled(System.Int32, System.Boolean)

Kind: Method

public System.Void SetTabDisabled(System.Int32, System.Boolean)(System.Int32 tabIndex, System.Boolean disabled)

Summary

Sets whether a tab is disabled.

Remarks

Disabled tabs remain visible but cannot be selected through pointer input or next/previous selection helpers.

Parameters

  • tabIndex: The zero-based tab index.
  • disabled: true to disable the tab; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.IsTabDisabled(System.Int32)

SetTabHidden(System.Int32, System.Boolean)

Kind: Method

public System.Void SetTabHidden(System.Int32, System.Boolean)(System.Int32 tabIndex, System.Boolean hidden)

Summary

Sets whether a tab is hidden.

Remarks

Hidden tabs are not drawn in the header and cannot be selected. Their pages are also hidden unless selected again after being shown.

Parameters

  • tabIndex: The zero-based tab index.
  • hidden: true to hide the tab; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.IsTabHidden(System.Int32)

SetTabIcon(System.Int32, Electron2D.Texture2D)

Kind: Method

public System.Void SetTabIcon(System.Int32, Electron2D.Texture2D)(System.Int32 tabIndex, Electron2D.Texture2D icon)

Summary

Sets the icon displayed by a tab button.

Remarks

Icons are metadata for tab drawing and generated documentation. The preview renderer may omit icon drawing when no texture backend consumes the canvas command.

Parameters

  • tabIndex: The zero-based tab index.
  • icon: The icon texture, or null to clear it.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.GetTabIcon(System.Int32)

SetTabTitle(System.Int32, System.String)

Kind: Method

public System.Void SetTabTitle(System.Int32, System.String)(System.Int32 tabIndex, System.String title)

Summary

Sets the title displayed by a tab button.

Remarks

Empty titles are valid. When no title is assigned, the child control name is used as a fallback by Electron2D.TabContainer.GetTabTitle(System.Int32).

Parameters

  • tabIndex: The zero-based tab index.
  • title: The title to display.

Exceptions

  • System.ArgumentNullException: Thrown when title is null.
  • System.ArgumentOutOfRangeException: Thrown when tabIndex is outside the tab range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TabContainer.GetTabTitle(System.Int32)

_Draw()

Kind: Method

public System.Void _Draw()()

Summary

Draws the tab header and tab button labels.

Remarks

Text drawing is skipped when no theme font is available. Page controls are drawn by their own canvas item callbacks.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CanvasItem.DrawRect(Electron2D.Rect2,Electron2D.Color,System.Boolean,System.Single,System.Boolean)

_GetMinimumSize()

Kind: Method

public Electron2D.Vector2 _GetMinimumSize()()

Summary

Gets the minimum size requested by this tab container.

Remarks

Hidden tabs contribute to the size only when Electron2D.TabContainer.UseHiddenTabsForMinSize is true.

Returns

A size that can contain the largest measured tab page and the tab header.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control.GetMinimumSize

_GuiInput(Electron2D.InputEvent)

Kind: Method

public System.Void _GuiInput(Electron2D.InputEvent)(Electron2D.InputEvent inputEvent)

Summary

Handles GUI input routed to this tab container.

Remarks

Mouse and touch press over a tab header button select that tab. Disabled and hidden tabs are ignored.

Parameters

  • inputEvent: The input event delivered by the viewport.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control._GuiInput(Electron2D.InputEvent)

Clone this wiki locally