Tabs

Inherits: Control < CanvasItem < Node < Object

Category: Core

Brief Description

Tabs Control.

Properties

intcurrent_tab
booldrag_to_rearrange_enabled
boolscrolling_enabled
TabAligntab_align
CloseButtonDisplayPolicytab_close_display_policy

Methods

voidadd_tab ( String title=”“, Texture icon=null )
voidensure_tab_visible ( int idx )
boolget_offset_buttons_visible ( ) const
boolget_select_with_rmb ( ) const
intget_tab_count ( ) const
boolget_tab_disabled ( int tab_idx ) const
Textureget_tab_icon ( int tab_idx ) const
intget_tab_offset ( ) const
Rect2get_tab_rect ( int tab_idx ) const
Stringget_tab_title ( int tab_idx ) const
intget_tabs_rearrange_group ( ) const
voidmove_tab ( int from, int to )
voidremove_tab ( int tab_idx )
voidset_select_with_rmb ( bool enabled )
voidset_tab_disabled ( int tab_idx, bool disabled )
voidset_tab_icon ( int tab_idx, Texture icon )
voidset_tab_title ( int tab_idx, String title )
voidset_tabs_rearrange_group ( int group_id )

Theme Properties

StyleBoxbutton
StyleBoxbutton_pressed
Textureclose
Texturedecrement
Texturedecrement_highlight
Fontfont
Colorfont_color_bg
Colorfont_color_disabled
Colorfont_color_fg
inthseparation
Textureincrement
Textureincrement_highlight
intlabel_valign_bg
intlabel_valign_fg
StyleBoxpanel
StyleBoxtab_bg
StyleBoxtab_disabled
StyleBoxtab_fg
inttop_margin

Signals

  • reposition_active_tab_request ( int idx_to )

  • right_button_pressed ( int tab )

  • tab_changed ( int tab )

  • tab_clicked ( int tab )

  • tab_close ( int tab )

  • tab_hover ( int tab )

Enumerations

enum TabAlign:

  • ALIGN_LEFT = 0 — Align the tabs to the left.
  • ALIGN_CENTER = 1 — Align the tabs to the center.
  • ALIGN_RIGHT = 2 — Align the tabs to the right.
  • ALIGN_MAX = 3 — Represents the size of the TabAlign enum.

enum CloseButtonDisplayPolicy:

  • CLOSE_BUTTON_SHOW_NEVER = 0
  • CLOSE_BUTTON_SHOW_ACTIVE_ONLY = 1
  • CLOSE_BUTTON_SHOW_ALWAYS = 2
  • CLOSE_BUTTON_MAX = 3 — Represents the size of the CloseButtonDisplayPolicy enum.

Description

Simple tabs control, similar to TabContainer but is only in charge of drawing tabs, not interact with children.

Property Descriptions

  • int current_tab
Setterset_current_tab(value)
Getterget_current_tab()

Select tab at index tab_idx.


  • bool drag_to_rearrange_enabled
Setterset_drag_to_rearrange_enabled(value)
Getterget_drag_to_rearrange_enabled()

If true, tabs can be rearranged with mouse drag.


  • bool scrolling_enabled
Setterset_scrolling_enabled(value)
Getterget_scrolling_enabled()

Setterset_tab_align(value)
Getterget_tab_align()

The alignment of all tabs. See enum TabAlign constants for details.


Setterset_tab_close_display_policy(value)
Getterget_tab_close_display_policy()

Method Descriptions

Adds a new tab.


  • void ensure_tab_visible ( int idx )

Moves the Scroll view to make the tab visible.


  • bool get_offset_buttons_visible ( ) const

  • bool get_select_with_rmb ( ) const

Returns true if select with right mouse button is enabled.


  • int get_tab_count ( ) const

Returns the number of tabs.


  • bool get_tab_disabled ( int tab_idx ) const

Returns true if the tab at index tab_idx is disabled.


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


  • int get_tab_offset ( ) const

  • Rect2 get_tab_rect ( int tab_idx ) const

Returns tab Rect2 with local position and size.


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


  • int get_tabs_rearrange_group ( ) const

Returns the Tabs rearrange group id.


  • void move_tab ( int from, int to )

Rearrange tab.


  • void remove_tab ( int tab_idx )

Removes tab at index tab_idx


  • void set_select_with_rmb ( bool enabled )

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


  • void set_tab_disabled ( int tab_idx, bool disabled )

If disabled is false, hides the tab at index tab_idx. Note that its title text will remain, unless also removed with set_tab_title.


Sets an icon for the tab at index tab_idx.


  • void set_tab_title ( int tab_idx, String title )

Sets a title for the tab at index tab_idx.


  • void set_tabs_rearrange_group ( int group_id )

Defines rearrange group id, choose for each Tabs the same value to enable tab drag between Tabs. Enable drag with set_drag_to_rearrange_enabled(true).