TabContainer

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Arranges child controls into a tabbed view, creating a tab for each one. The active tab's corresponding control is made visible, while all other child controls are hidden. Ignores non-control children.

Note: The drawing of the clickable tabs is handled by this node; TabBar is not needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsTabContainer() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsContainer

func (self *Extension[T]) AsContainer() Container.Instance

func (*Extension[T]) AsControl

func (self *Extension[T]) AsControl() Control.Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsTabContainer

func (self *Extension[T]) AsTabContainer() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.TabContainer

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AllTabsInFront

func (self Instance) AllTabsInFront() bool

If true, all tabs are drawn in front of the panel. If false, inactive tabs are drawn behind the panel.

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsContainer

func (self Instance) AsContainer() Container.Instance

func (Instance) AsControl

func (self Instance) AsControl() Control.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsTabContainer

func (self Instance) AsTabContainer() Instance

func (Instance) ClipTabs

func (self Instance) ClipTabs() bool

If true, tabs overflowing this node's width will be hidden, displaying two navigation buttons instead. Otherwise, this node's minimum size is updated so that all tabs are visible.

func (Instance) CurrentTab

func (self Instance) CurrentTab() int

The current tab index. When set, this index's Control node's visible property is set to true and all others are set to false.

A value of -1 means that no tab is selected.

func (Instance) DeselectEnabled

func (self Instance) DeselectEnabled() bool

If true, all tabs can be deselected so that no tab is selected. Click on the CurrentTab to deselect it.

Only the tab header will be shown if no tabs are selected.

func (Instance) DragToRearrangeEnabled

func (self Instance) DragToRearrangeEnabled() bool

If true, tabs can be rearranged with mouse drag.

func (Instance) GetCurrentTabControl

func (self Instance) GetCurrentTabControl() Control.Instance

Returns the child Control node located at the active tab index.

func (Instance) GetPopup

func (self Instance) GetPopup() Popup.Instance

Returns the Popup node instance if one has been set already with SetPopup.

Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their Window.Visible property.

func (Instance) GetPreviousTab

func (self Instance) GetPreviousTab() int

Returns the previously active tab index.

func (Instance) GetTabBar

func (self Instance) GetTabBar() TabBar.Instance

Returns the TabBar contained in this container.

Warning: This is a required internal node, removing and freeing it or editing its tabs may cause a crash. If you wish to edit the tabs, use the methods provided in TabContainer.

func (Instance) GetTabButtonIcon

func (self Instance) GetTabButtonIcon(tab_idx int) Texture2D.Instance

Returns the button icon from the tab at index 'tab_idx'.

func (Instance) GetTabControl

func (self Instance) GetTabControl(tab_idx int) Control.Instance

Returns the Control node from the tab at index 'tab_idx'.

func (Instance) GetTabCount

func (self Instance) GetTabCount() int

Returns the number of tabs.

func (Instance) GetTabIcon

func (self Instance) GetTabIcon(tab_idx int) Texture2D.Instance

Returns the Texture2D for the tab at index 'tab_idx' or null if the tab has no Texture2D.

func (Instance) GetTabIconMaxWidth

func (self Instance) GetTabIconMaxWidth(tab_idx int) int

Returns the maximum allowed width of the icon for the tab at index 'tab_idx'.

func (Instance) GetTabIdxAtPoint

func (self Instance) GetTabIdxAtPoint(point Vector2.XY) int

Returns the index of the tab at local coordinates 'point'. Returns -1 if the point is outside the control boundaries or if there's no tab at the queried position.

func (Instance) GetTabIdxFromControl

func (self Instance) GetTabIdxFromControl(control Control.Instance) int

Returns the index of the tab tied to the given 'control'. The control must be a child of the TabContainer.

func (Instance) GetTabMetadata

func (self Instance) GetTabMetadata(tab_idx int) any

Returns the metadata value set to the tab at index 'tab_idx' using SetTabMetadata. If no metadata was previously set, returns null by default.

func (Instance) GetTabTitle

func (self Instance) GetTabTitle(tab_idx int) string

Returns the title of the tab at index 'tab_idx'. Tab titles default to the name of the indexed child node, but this can be overridden with SetTabTitle.

func (Instance) GetTabTooltip

func (self Instance) GetTabTooltip(tab_idx int) string

Returns the tooltip text of the tab at index 'tab_idx'.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsTabDisabled

func (self Instance) IsTabDisabled(tab_idx int) bool

Returns true if the tab at index 'tab_idx' is disabled.

func (Instance) IsTabHidden

func (self Instance) IsTabHidden(tab_idx int) bool

Returns true if the tab at index 'tab_idx' is hidden.

func (Instance) OnActiveTabRearranged

func (self Instance) OnActiveTabRearranged(cb func(idx_to int), flags ...Signal.Flags)

Emitted when the active tab is rearranged via mouse drag. See DragToRearrangeEnabled.

func (Instance) OnPrePopupPressed

func (self Instance) OnPrePopupPressed(cb func(), flags ...Signal.Flags)

Emitted when the TabContainer's Popup button is clicked. See SetPopup for details.

func (Instance) OnTabButtonPressed

func (self Instance) OnTabButtonPressed(cb func(tab int), flags ...Signal.Flags)

Emitted when the user clicks on the button icon on this tab.

func (Instance) OnTabChanged

func (self Instance) OnTabChanged(cb func(tab int), flags ...Signal.Flags)

Emitted when switching to another tab.

func (Instance) OnTabClicked

func (self Instance) OnTabClicked(cb func(tab int), flags ...Signal.Flags)

Emitted when a tab is clicked, even if it is the current tab.

func (Instance) OnTabHovered

func (self Instance) OnTabHovered(cb func(tab int), flags ...Signal.Flags)

Emitted when a tab is hovered by the mouse.

func (Instance) OnTabSelected

func (self Instance) OnTabSelected(cb func(tab int), flags ...Signal.Flags)

Emitted when a tab is selected via click, directional input, or script, even if it is the current tab.

func (Instance) SelectNextAvailable

func (self Instance) SelectNextAvailable() bool

Selects the first available tab with greater index than the currently selected. Returns true if tab selection changed.

func (Instance) SelectPreviousAvailable

func (self Instance) SelectPreviousAvailable() bool

Selects the first available tab with lower index than the currently selected. Returns true if tab selection changed.

func (Instance) SetAllTabsInFront

func (self Instance) SetAllTabsInFront(value bool)

SetAllTabsInFront sets the property returned by [IsAllTabsInFront].

func (Instance) SetClipTabs

func (self Instance) SetClipTabs(value bool)

SetClipTabs sets the property returned by [GetClipTabs].

func (Instance) SetCurrentTab

func (self Instance) SetCurrentTab(value int)

SetCurrentTab sets the property returned by [GetCurrentTab].

func (Instance) SetDeselectEnabled

func (self Instance) SetDeselectEnabled(value bool)

SetDeselectEnabled sets the property returned by [GetDeselectEnabled].

func (Instance) SetDragToRearrangeEnabled

func (self Instance) SetDragToRearrangeEnabled(value bool)

SetDragToRearrangeEnabled sets the property returned by [GetDragToRearrangeEnabled].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetPopup

func (self Instance) SetPopup(popup Node.Instance)

If set on a Popup node instance, a popup menu icon appears in the top-right corner of the TabContainer (setting it to null will make it go away). Clicking it will expand the Popup node.

func (Instance) SetTabAlignment

func (self Instance) SetTabAlignment(value TabBar.AlignmentMode)

SetTabAlignment sets the property returned by [GetTabAlignment].

func (Instance) SetTabButtonIcon

func (self Instance) SetTabButtonIcon(tab_idx int, icon Texture2D.Instance)

Sets the button icon from the tab at index 'tab_idx'.

func (Instance) SetTabDisabled

func (self Instance) SetTabDisabled(tab_idx int, disabled bool)

If 'disabled' is true, disables the tab at index 'tab_idx', making it non-interactable.

func (Instance) SetTabFocusMode

func (self Instance) SetTabFocusMode(value Control.FocusMode)

SetTabFocusMode sets the property returned by [GetTabFocusMode].

func (Instance) SetTabHidden

func (self Instance) SetTabHidden(tab_idx int, hidden bool)

If 'hidden' is true, hides the tab at index 'tab_idx', making it disappear from the tab area.

func (Instance) SetTabIcon

func (self Instance) SetTabIcon(tab_idx int, icon Texture2D.Instance)

Sets an icon for the tab at index 'tab_idx'.

func (Instance) SetTabIconMaxWidth

func (self Instance) SetTabIconMaxWidth(tab_idx int, width int)

Sets the maximum allowed width of the icon for the tab at index 'tab_idx'. This limit is applied on top of the default size of the icon and on top of theme's 'icon_max_width'. The height is adjusted according to the icon's ratio.

func (Instance) SetTabMetadata

func (self Instance) SetTabMetadata(tab_idx int, metadata any)

Sets the metadata value for the tab at index 'tab_idx', which can be retrieved later using GetTabMetadata.

func (Instance) SetTabTitle

func (self Instance) SetTabTitle(tab_idx int, title string)

Sets a custom title for the tab at index 'tab_idx' (tab titles default to the name of the indexed child node). Set it back to the child's name to make the tab default to it again.

func (Instance) SetTabTooltip

func (self Instance) SetTabTooltip(tab_idx int, tooltip string)

Sets a custom tooltip text for tab at index 'tab_idx'.

Note: By default, if the 'tooltip' is empty and the tab text is truncated (not all characters fit into the tab), the title will be displayed as a tooltip. To hide the tooltip, assign " " as the 'tooltip' text.

func (Instance) SetTabsPosition

func (self Instance) SetTabsPosition(value TabPosition)

SetTabsPosition sets the property returned by [GetTabsPosition].

func (Instance) SetTabsRearrangeGroup

func (self Instance) SetTabsRearrangeGroup(value int)

SetTabsRearrangeGroup sets the property returned by [GetTabsRearrangeGroup].

func (Instance) SetTabsVisible

func (self Instance) SetTabsVisible(value bool)

SetTabsVisible sets the property returned by [AreTabsVisible].

func (Instance) SetUseHiddenTabsForMinSize

func (self Instance) SetUseHiddenTabsForMinSize(value bool)

SetUseHiddenTabsForMinSize sets the property returned by [GetUseHiddenTabsForMinSize].

func (Instance) TabAlignment

func (self Instance) TabAlignment() TabBar.AlignmentMode

The position at which tabs will be placed.

func (Instance) TabFocusMode

func (self Instance) TabFocusMode() Control.FocusMode

The focus access mode for the internal TabBar node.

func (Instance) TabsPosition

func (self Instance) TabsPosition() TabPosition

The position of the tab bar.

func (Instance) TabsRearrangeGroup

func (self Instance) TabsRearrangeGroup() int

TabContainers with the same rearrange group ID will allow dragging the tabs between them. Enable drag with DragToRearrangeEnabled.

Setting this to -1 will disable rearranging between TabContainers.

func (Instance) TabsVisible

func (self Instance) TabsVisible() bool

If true, tabs are visible. If false, tabs' content and titles are hidden.

func (Instance) UseHiddenTabsForMinSize

func (self Instance) UseHiddenTabsForMinSize() bool

If true, child Control nodes that are hidden have their minimum size take into account in the total, instead of only the currently visible one.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type TabPosition

type TabPosition int //gd:TabContainer.TabPosition
const (
	// Places the tab bar at the top.
	PositionTop TabPosition = 0
	// Places the tab bar at the bottom. The tab bar's [StyleBox] will be flipped vertically.
	//
	// [StyleBox]: https://pkg.go.dev/graphics.gd/classdb/StyleBox
	PositionBottom TabPosition = 1
	// Represents the size of the [TabPosition] enum.
	PositionMax TabPosition = 2
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL