Tabs¶
Inherits: Control < CanvasItem < Node < Object
Tabs control.
Description¶
Simple tabs control, similar to TabContainer but is only in charge of drawing tabs, not interact with children.
Properties¶
|
||
|
||
|
||
|
||
|
Methods¶
void |
|
void |
ensure_tab_visible ( int idx ) |
get_offset_buttons_visible ( ) const |
|
get_select_with_rmb ( ) const |
|
get_tab_count ( ) const |
|
get_tab_disabled ( int tab_idx ) const |
|
get_tab_icon ( int tab_idx ) const |
|
get_tab_offset ( ) const |
|
get_tab_rect ( int tab_idx ) const |
|
get_tab_title ( int tab_idx ) const |
|
get_tabs_rearrange_group ( ) const |
|
void |
|
void |
remove_tab ( int tab_idx ) |
void |
set_select_with_rmb ( bool enabled ) |
void |
set_tab_disabled ( int tab_idx, bool disabled ) |
void |
set_tab_icon ( int tab_idx, Texture icon ) |
void |
set_tab_title ( int tab_idx, String title ) |
void |
set_tabs_rearrange_group ( int group_id ) |
Theme Properties¶
button |
||
button_pressed |
||
close |
||
decrement |
||
decrement_highlight |
||
font |
||
font_color_bg |
Color( 0.69, 0.69, 0.69, 1 ) |
|
font_color_disabled |
Color( 0.9, 0.9, 0.9, 0.2 ) |
|
font_color_fg |
Color( 0.94, 0.94, 0.94, 1 ) |
|
hseparation |
4 |
|
increment |
||
increment_highlight |
||
label_valign_bg |
2 |
|
label_valign_fg |
0 |
|
panel |
||
tab_bg |
||
tab_disabled |
||
tab_fg |
||
top_margin |
24 |
Signals¶
reposition_active_tab_request ( int idx_to )
Emitted when the active tab is rearranged via mouse drag. See drag_to_rearrange_enabled.
right_button_pressed ( int tab )
Emitted when a tab is right-clicked.
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 ( int tab )
Emitted when a tab is closed.
tab_hover ( int tab )
Emitted when a tab is hovered by the mouse.
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.
CLOSE_BUTTON_SHOW_NEVER = 0 --- Never show the close buttons.
CLOSE_BUTTON_SHOW_ACTIVE_ONLY = 1 --- Only show the close button on the currently active tab.
CLOSE_BUTTON_SHOW_ALWAYS = 2 --- Show the close button on all tabs.
CLOSE_BUTTON_MAX = 3 --- Represents the size of the CloseButtonDisplayPolicy enum.
Property Descriptions¶
int current_tab
Default |
|
Setter |
set_current_tab(value) |
Getter |
get_current_tab() |
Select tab at index tab_idx
.
bool drag_to_rearrange_enabled
Default |
|
Setter |
set_drag_to_rearrange_enabled(value) |
Getter |
get_drag_to_rearrange_enabled() |
If true
, tabs can be rearranged with mouse drag.
bool scrolling_enabled
Default |
|
Setter |
set_scrolling_enabled(value) |
Getter |
get_scrolling_enabled() |
if true
, the mouse's scroll wheel cab be used to navigate the scroll view.
TabAlign tab_align
Default |
|
Setter |
set_tab_align(value) |
Getter |
get_tab_align() |
The alignment of all tabs. See TabAlign for details.
CloseButtonDisplayPolicy tab_close_display_policy
Default |
|
Setter |
set_tab_close_display_policy(value) |
Getter |
get_tab_close_display_policy() |
Sets when the close button will appear on the tabs. See CloseButtonDisplayPolicy for details.
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
Returns true
if the offset buttons (the ones that appear when there's not enough space for all tabs) are visible.
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.
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
Returns the number of hidden tabs offsetted to the left.
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.
Moves a tab from from
to to
.
void remove_tab ( int tab_idx )
Removes the tab at index tab_idx
.
void set_select_with_rmb ( bool enabled )
If true
, enables selecting a tab with the right mouse button.
If disabled
is false
, hides the tab at index tab_idx
.
Note: Its title text will remain unless it is also removed with set_tab_title.
Sets an icon
for the tab at index tab_idx
.
Sets a title
for the tab at index tab_idx
.
void set_tabs_rearrange_group ( int group_id )
Defines the rearrange group ID. Choose for each Tabs
the same value to dragging tabs between Tabs
. Enable drag with set_drag_to_rearrange_enabled(true)
.