TabBar

package
v0.0.0-...-5e8c587 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

A control that provides a horizontal bar with tabs. Similar to TabContainer but is only in charge of drawing tabs, not interacting with children.

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 AlignmentMode

type AlignmentMode int //gd:TabBar.AlignmentMode
const (
	// Places tabs to the left.
	AlignmentLeft AlignmentMode = 0
	// Places tabs in the middle.
	AlignmentCenter AlignmentMode = 1
	// Places tabs to the right.
	AlignmentRight AlignmentMode = 2
	// Represents the size of the [AlignmentMode] enum.
	AlignmentMax AlignmentMode = 3
)

type Any

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

type CloseButtonDisplayPolicy

type CloseButtonDisplayPolicy int //gd:TabBar.CloseButtonDisplayPolicy
const (
	// Never show the close buttons.
	CloseButtonShowNever CloseButtonDisplayPolicy = 0
	// Only show the close button on the currently active tab.
	CloseButtonShowActiveOnly CloseButtonDisplayPolicy = 1
	// Show the close button on all tabs.
	CloseButtonShowAlways CloseButtonDisplayPolicy = 2
	// Represents the size of the [CloseButtonDisplayPolicy] enum.
	CloseButtonMax CloseButtonDisplayPolicy = 3
)

type Expanded

type Expanded = MoreArgs

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]) 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]) AsTabBar

func (self *Extension[T]) AsTabBar() 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.TabBar

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) AddTab

func (self Instance) AddTab()

Adds a new tab.

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.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) AsTabBar

func (self Instance) AsTabBar() Instance

func (Instance) ClearTabs

func (self Instance) ClearTabs()

Clears all tabs.

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) CloseWithMiddleMouse

func (self Instance) CloseWithMiddleMouse() bool

If true, middle clicking on the mouse will fire the OnTabClosePressed signal.

func (Instance) CurrentTab

func (self Instance) CurrentTab() int

The index of the current selected tab. A value of -1 means that no tab is selected and can only be set when DeselectEnabled is true or if all tabs are hidden or disabled.

func (Instance) DeselectEnabled

func (self Instance) DeselectEnabled() bool

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

func (Instance) DragToRearrangeEnabled

func (self Instance) DragToRearrangeEnabled() bool

If true, tabs can be rearranged with mouse drag.

func (Instance) EnsureTabVisible

func (self Instance) EnsureTabVisible(idx int)

Moves the scroll view to make the tab visible.

func (Instance) GetOffsetButtonsVisible

func (self Instance) GetOffsetButtonsVisible() bool

Returns true if the offset buttons (the ones that appear when there's not enough space for all tabs) are visible.

func (Instance) GetPreviousTab

func (self Instance) GetPreviousTab() int

Returns the previously active tab index.

func (Instance) GetTabButtonIcon

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

Returns the icon for the right button of the tab at index 'tab_idx' or null if the right button has no icon.

func (Instance) GetTabIcon

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

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

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) GetTabLanguage

func (self Instance) GetTabLanguage(tab_idx int) string

Returns tab title language code.

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) GetTabOffset

func (self Instance) GetTabOffset() int

Returns the number of hidden tabs offsetted to the left.

func (Instance) GetTabRect

func (self Instance) GetTabRect(tab_idx int) Rect2.PositionSize

Returns tab Rect2.PositionSize with local position and size.

func (Instance) GetTabTextDirection

func (self Instance) GetTabTextDirection(tab_idx int) Control.TextDirection

Returns tab title text base writing direction.

func (Instance) GetTabTitle

func (self Instance) GetTabTitle(tab_idx int) string

Returns the title of the tab at index 'tab_idx'.

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) MaxTabWidth

func (self Instance) MaxTabWidth() int

Sets the maximum width which all tabs should be limited to. Unlimited if set to 0.

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) MoveTab

func (self Instance) MoveTab(from int, to int)

Moves a tab from 'from' to 'to'.

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) OnTabButtonPressed

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

Emitted when a tab's right button is pressed. See SetTabButtonIcon.

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) OnTabClosePressed

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

Emitted when a tab's close button is pressed or when middle-clicking on a tab, if CloseWithMiddleMouse is enabled.

Note: Tabs are not removed automatically once the close button is pressed, this behavior needs to be programmed manually. For example:

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) OnTabRmbClicked

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

Emitted when a tab is right-clicked. SelectWithRmb must be enabled.

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) RemoveTab

func (self Instance) RemoveTab(tab_idx int)

Removes the tab at index 'tab_idx'.

func (Instance) ScrollToSelected

func (self Instance) ScrollToSelected() bool

If true, the tab offset will be changed to keep the currently selected tab visible.

func (Instance) ScrollingEnabled

func (self Instance) ScrollingEnabled() bool

if true, the mouse's scroll wheel can be used to navigate the scroll view.

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) SelectWithRmb

func (self Instance) SelectWithRmb() bool

If true, enables selecting a tab with the right mouse button.

func (Instance) SetClipTabs

func (self Instance) SetClipTabs(value bool)

SetClipTabs sets the property returned by [GetClipTabs].

func (Instance) SetCloseWithMiddleMouse

func (self Instance) SetCloseWithMiddleMouse(value bool)

SetCloseWithMiddleMouse sets the property returned by [GetCloseWithMiddleMouse].

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) SetMaxTabWidth

func (self Instance) SetMaxTabWidth(value int)

SetMaxTabWidth sets the property returned by [GetMaxTabWidth].

func (*Instance) SetObject

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

func (Instance) SetScrollToSelected

func (self Instance) SetScrollToSelected(value bool)

SetScrollToSelected sets the property returned by [GetScrollToSelected].

func (Instance) SetScrollingEnabled

func (self Instance) SetScrollingEnabled(value bool)

SetScrollingEnabled sets the property returned by [GetScrollingEnabled].

func (Instance) SetSelectWithRmb

func (self Instance) SetSelectWithRmb(value bool)

SetSelectWithRmb sets the property returned by [GetSelectWithRmb].

func (Instance) SetTabAlignment

func (self Instance) SetTabAlignment(value AlignmentMode)

SetTabAlignment sets the property returned by [GetTabAlignment].

func (Instance) SetTabButtonIcon

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

Sets an 'icon' for the button of the tab at index 'tab_idx' (located to the right, before the close button), making it visible and clickable (See OnTabButtonPressed). Giving it a null value will hide the button.

func (Instance) SetTabCloseDisplayPolicy

func (self Instance) SetTabCloseDisplayPolicy(value CloseButtonDisplayPolicy)

SetTabCloseDisplayPolicy sets the property returned by [GetTabCloseDisplayPolicy].

func (Instance) SetTabCount

func (self Instance) SetTabCount(value int)

SetTabCount sets the property returned by [GetTabCount].

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) 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) SetTabLanguage

func (self Instance) SetTabLanguage(tab_idx int, language string)

Sets language code of tab title used for line-breaking and text shaping algorithms, if left empty current locale is used instead.

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) SetTabTextDirection

func (self Instance) SetTabTextDirection(tab_idx int, direction Control.TextDirection)

Sets tab title base writing direction.

func (Instance) SetTabTitle

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

Sets a 'title' for the tab at index 'tab_idx'.

func (Instance) SetTabTooltip

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

Sets a 'tooltip' 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) SetTabsRearrangeGroup

func (self Instance) SetTabsRearrangeGroup(value int)

SetTabsRearrangeGroup sets the property returned by [GetTabsRearrangeGroup].

func (Instance) TabAlignment

func (self Instance) TabAlignment() AlignmentMode

The position at which tabs will be placed.

func (Instance) TabCloseDisplayPolicy

func (self Instance) TabCloseDisplayPolicy() CloseButtonDisplayPolicy

When the close button will appear on the tabs.

func (Instance) TabCount

func (self Instance) TabCount() int

The number of tabs currently in the bar.

func (Instance) TabsRearrangeGroup

func (self Instance) TabsRearrangeGroup() int

TabBars 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 TabBars.

func (Instance) Virtual

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

type MoreArgs

type MoreArgs [1]gdclass.TabBar

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) AddTab

func (self MoreArgs) AddTab(title string, icon Texture2D.Instance)

Adds a new tab.

Jump to

Keyboard shortcuts

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