Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
TabBar¶
Inherits: Control < CanvasItem < Node < Object
A control that provides a horizontal bar with tabs.
Description¶
A control that provides a horizontal bar with tabs. Similar to TabContainer but is only in charge of drawing tabs, not interacting with children.
Properties¶
|
||
|
||
|
||
focus_mode |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
void |
|
void |
clear_tabs ( ) |
void |
ensure_tab_visible ( int idx ) |
get_offset_buttons_visible ( ) const |
|
get_previous_tab ( ) const |
|
get_tab_button_icon ( int tab_idx ) const |
|
get_tab_icon ( int tab_idx ) const |
|
get_tab_icon_max_width ( int tab_idx ) const |
|
get_tab_idx_at_point ( Vector2 point ) const |
|
get_tab_language ( int tab_idx ) const |
|
get_tab_metadata ( int tab_idx ) const |
|
get_tab_offset ( ) const |
|
get_tab_rect ( int tab_idx ) const |
|
get_tab_text_direction ( int tab_idx ) const |
|
get_tab_title ( int tab_idx ) const |
|
is_tab_disabled ( int tab_idx ) const |
|
is_tab_hidden ( int tab_idx ) const |
|
void |
|
void |
remove_tab ( int tab_idx ) |
void |
set_tab_button_icon ( int tab_idx, Texture2D icon ) |
void |
set_tab_disabled ( int tab_idx, bool disabled ) |
void |
set_tab_hidden ( int tab_idx, bool hidden ) |
void |
set_tab_icon ( int tab_idx, Texture2D icon ) |
void |
set_tab_icon_max_width ( int tab_idx, int width ) |
void |
set_tab_language ( int tab_idx, String language ) |
void |
set_tab_metadata ( int tab_idx, Variant metadata ) |
void |
set_tab_text_direction ( int tab_idx, TextDirection direction ) |
void |
set_tab_title ( int tab_idx, String title ) |
Theme Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Signals¶
active_tab_rearranged ( int idx_to )
Emitted when the active tab is rearranged via mouse drag. See drag_to_rearrange_enabled.
tab_button_pressed ( int tab )
Emitted when a tab's right button is pressed. See set_tab_button_icon.
tab_changed ( int tab )
Emitted when switching to another tab.
tab_clicked ( int tab )
Emitted when a tab is clicked, even if it is the current tab.
tab_close_pressed ( int tab )
Emitted when a tab's close button is pressed.
Note: Tabs are not removed automatically once the close button is pressed, this behavior needs to be programmed manually. For example:
$TabBar.tab_close_pressed.connect($TabBar.remove_tab)
GetNode<TabBar>("TabBar").TabClosePressed += GetNode<TabBar>("TabBar").RemoveTab;
tab_hovered ( int tab )
Emitted when a tab is hovered by the mouse.
tab_rmb_clicked ( int tab )
Emitted when a tab is right-clicked. select_with_rmb must be enabled.
tab_selected ( int tab )
Emitted when a tab is selected via click, directional input, or script, even if it is the current tab.
Enumerations¶
enum AlignmentMode:
AlignmentMode ALIGNMENT_LEFT = 0
Places tabs to the left.
AlignmentMode ALIGNMENT_CENTER = 1
Places tabs in the middle.
AlignmentMode ALIGNMENT_RIGHT = 2
Places tabs to the right.
AlignmentMode ALIGNMENT_MAX = 3
Represents the size of the AlignmentMode enum.
enum CloseButtonDisplayPolicy:
CloseButtonDisplayPolicy CLOSE_BUTTON_SHOW_NEVER = 0
Never show the close buttons.