Files
godot-docs-l10n/classes/zh_Hant/class_tabbar.rst
Rémi Verschelde c3f2364c10 Sync classref with 4.6 branch
Lots of translations invalidated (fuzzied) as we just synced Weblate.
2025-12-19 16:39:51 +01:00

1422 lines
68 KiB
ReStructuredText

:github_url: hide
.. _class_TabBar:
TabBar
======
**繼承:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
提供水平分頁欄的控制項。
.. rst-class:: classref-introduction-group
說明
----
提供水平分頁欄的控制項。類似於 :ref:`TabContainer<class_TabContainer>`\ ,但只負責繪製分頁,不與子節點互動。
.. rst-class:: classref-reftable-group
屬性
----
.. table::
:widths: auto
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`clip_tabs<class_TabBar_property_clip_tabs>` | ``true`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`close_with_middle_mouse<class_TabBar_property_close_with_middle_mouse>` | ``true`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`current_tab<class_TabBar_property_current_tab>` | ``-1`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`deselect_enabled<class_TabBar_property_deselect_enabled>` | ``false`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`drag_to_rearrange_enabled<class_TabBar_property_drag_to_rearrange_enabled>` | ``false`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`max_tab_width<class_TabBar_property_max_tab_width>` | ``0`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`scroll_to_selected<class_TabBar_property_scroll_to_selected>` | ``true`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`scrolling_enabled<class_TabBar_property_scrolling_enabled>` | ``true`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`select_with_rmb<class_TabBar_property_select_with_rmb>` | ``false`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`switch_on_drag_hover<class_TabBar_property_switch_on_drag_hover>` | ``true`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` | :ref:`tab_alignment<class_TabBar_property_tab_alignment>` | ``0`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>` | :ref:`tab_close_display_policy<class_TabBar_property_tab_close_display_policy>` | ``0`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`tab_count<class_TabBar_property_tab_count>` | ``0`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`tabs_rearrange_group<class_TabBar_property_tabs_rearrange_group>` | ``-1`` |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_tab<class_TabBar_method_add_tab>`\ (\ title\: :ref:`String<class_String>` = "", icon\: :ref:`Texture2D<class_Texture2D>` = null\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_tabs<class_TabBar_method_clear_tabs>`\ (\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`ensure_tab_visible<class_TabBar_method_ensure_tab_visible>`\ (\ idx\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_offset_buttons_visible<class_TabBar_method_get_offset_buttons_visible>`\ (\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_previous_tab<class_TabBar_method_get_previous_tab>`\ (\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`get_tab_button_icon<class_TabBar_method_get_tab_button_icon>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`get_tab_icon<class_TabBar_method_get_tab_icon>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_tab_icon_max_width<class_TabBar_method_get_tab_icon_max_width>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_tab_idx_at_point<class_TabBar_method_get_tab_idx_at_point>`\ (\ point\: :ref:`Vector2<class_Vector2>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_tab_language<class_TabBar_method_get_tab_language>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_tab_metadata<class_TabBar_method_get_tab_metadata>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_tab_offset<class_TabBar_method_get_tab_offset>`\ (\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Rect2<class_Rect2>` | :ref:`get_tab_rect<class_TabBar_method_get_tab_rect>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`get_tab_text_direction<class_TabBar_method_get_tab_text_direction>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_tab_title<class_TabBar_method_get_tab_title>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_tab_tooltip<class_TabBar_method_get_tab_tooltip>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_tab_disabled<class_TabBar_method_is_tab_disabled>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_tab_hidden<class_TabBar_method_is_tab_hidden>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`move_tab<class_TabBar_method_move_tab>`\ (\ from\: :ref:`int<class_int>`, to\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_tab<class_TabBar_method_remove_tab>`\ (\ tab_idx\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`select_next_available<class_TabBar_method_select_next_available>`\ (\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`select_previous_available<class_TabBar_method_select_previous_available>`\ (\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_button_icon<class_TabBar_method_set_tab_button_icon>`\ (\ tab_idx\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_disabled<class_TabBar_method_set_tab_disabled>`\ (\ tab_idx\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_hidden<class_TabBar_method_set_tab_hidden>`\ (\ tab_idx\: :ref:`int<class_int>`, hidden\: :ref:`bool<class_bool>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_icon<class_TabBar_method_set_tab_icon>`\ (\ tab_idx\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_icon_max_width<class_TabBar_method_set_tab_icon_max_width>`\ (\ tab_idx\: :ref:`int<class_int>`, width\: :ref:`int<class_int>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_language<class_TabBar_method_set_tab_language>`\ (\ tab_idx\: :ref:`int<class_int>`, language\: :ref:`String<class_String>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_metadata<class_TabBar_method_set_tab_metadata>`\ (\ tab_idx\: :ref:`int<class_int>`, metadata\: :ref:`Variant<class_Variant>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_text_direction<class_TabBar_method_set_tab_text_direction>`\ (\ tab_idx\: :ref:`int<class_int>`, direction\: :ref:`TextDirection<enum_Control_TextDirection>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_title<class_TabBar_method_set_tab_title>`\ (\ tab_idx\: :ref:`int<class_int>`, title\: :ref:`String<class_String>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_tab_tooltip<class_TabBar_method_set_tab_tooltip>`\ (\ tab_idx\: :ref:`int<class_int>`, tooltip\: :ref:`String<class_String>`\ ) |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
主題屬性
--------
.. table::
:widths: auto
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`drop_mark_color<class_TabBar_theme_color_drop_mark_color>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_disabled_color<class_TabBar_theme_color_font_disabled_color>` | ``Color(0.875, 0.875, 0.875, 0.5)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_hovered_color<class_TabBar_theme_color_font_hovered_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_outline_color<class_TabBar_theme_color_font_outline_color>` | ``Color(0, 0, 0, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_selected_color<class_TabBar_theme_color_font_selected_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_unselected_color<class_TabBar_theme_color_font_unselected_color>` | ``Color(0.7, 0.7, 0.7, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`icon_disabled_color<class_TabBar_theme_color_icon_disabled_color>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`icon_hovered_color<class_TabBar_theme_color_icon_hovered_color>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`icon_selected_color<class_TabBar_theme_color_icon_selected_color>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Color<class_Color>` | :ref:`icon_unselected_color<class_TabBar_theme_color_icon_unselected_color>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`int<class_int>` | :ref:`h_separation<class_TabBar_theme_constant_h_separation>` | ``4`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`int<class_int>` | :ref:`hover_switch_wait_msec<class_TabBar_theme_constant_hover_switch_wait_msec>` | ``500`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`int<class_int>` | :ref:`icon_max_width<class_TabBar_theme_constant_icon_max_width>` | ``0`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`int<class_int>` | :ref:`outline_size<class_TabBar_theme_constant_outline_size>` | ``0`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`int<class_int>` | :ref:`tab_separation<class_TabBar_theme_constant_tab_separation>` | ``0`` |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Font<class_Font>` | :ref:`font<class_TabBar_theme_font_font>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`int<class_int>` | :ref:`font_size<class_TabBar_theme_font_size_font_size>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`close<class_TabBar_theme_icon_close>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`decrement<class_TabBar_theme_icon_decrement>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`decrement_highlight<class_TabBar_theme_icon_decrement_highlight>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`drop_mark<class_TabBar_theme_icon_drop_mark>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`increment<class_TabBar_theme_icon_increment>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`increment_highlight<class_TabBar_theme_icon_increment_highlight>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`button_highlight<class_TabBar_theme_style_button_highlight>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`button_pressed<class_TabBar_theme_style_button_pressed>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`tab_disabled<class_TabBar_theme_style_tab_disabled>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`tab_focus<class_TabBar_theme_style_tab_focus>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`tab_hovered<class_TabBar_theme_style_tab_hovered>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`tab_selected<class_TabBar_theme_style_tab_selected>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`tab_unselected<class_TabBar_theme_style_tab_unselected>` | |
+-----------------------------------+-----------------------------------------------------------------------------------+-------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
訊號
----
.. _class_TabBar_signal_active_tab_rearranged:
.. rst-class:: classref-signal
**active_tab_rearranged**\ (\ idx_to\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_signal_active_tab_rearranged>`
通過滑鼠拖動重新排列活動分頁時發出。見 :ref:`drag_to_rearrange_enabled<class_TabBar_property_drag_to_rearrange_enabled>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_signal_tab_button_pressed:
.. rst-class:: classref-signal
**tab_button_pressed**\ (\ tab\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_signal_tab_button_pressed>`
分頁的右側按鈕被按下時發出。見 :ref:`set_tab_button_icon()<class_TabBar_method_set_tab_button_icon>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_signal_tab_changed:
.. rst-class:: classref-signal
**tab_changed**\ (\ tab\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_signal_tab_changed>`
切換到另一個分頁時發出。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_signal_tab_clicked:
.. rst-class:: classref-signal
**tab_clicked**\ (\ tab\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_signal_tab_clicked>`
按一下分頁時發出,即使它是目前分頁。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_signal_tab_close_pressed:
.. rst-class:: classref-signal
**tab_close_pressed**\ (\ tab\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_signal_tab_close_pressed>`
Emitted when a tab's close button is pressed or, if :ref:`close_with_middle_mouse<class_TabBar_property_close_with_middle_mouse>` is ``true``, when middle-clicking on a tab.
\ **Note:** Tabs are not removed automatically; this behavior needs to be coded manually. For example:
.. tabs::
.. code-tab:: gdscript
$TabBar.tab_close_pressed.connect($TabBar.remove_tab)
.. code-tab:: csharp
GetNode<TabBar>("TabBar").TabClosePressed += GetNode<TabBar>("TabBar").RemoveTab;
.. rst-class:: classref-item-separator
----
.. _class_TabBar_signal_tab_hovered:
.. rst-class:: classref-signal
**tab_hovered**\ (\ tab\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_signal_tab_hovered>`
當滑鼠懸停分頁時發出。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_signal_tab_rmb_clicked:
.. rst-class:: classref-signal
**tab_rmb_clicked**\ (\ tab\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_signal_tab_rmb_clicked>`
Emitted when a tab is right-clicked.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_signal_tab_selected:
.. rst-class:: classref-signal
**tab_selected**\ (\ tab\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_signal_tab_selected>`
Emitted when a tab is selected via click, directional input, or script, even if it is the current tab.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
列舉
----
.. _enum_TabBar_AlignmentMode:
.. rst-class:: classref-enumeration
enum **AlignmentMode**: :ref:`🔗<enum_TabBar_AlignmentMode>`
.. _class_TabBar_constant_ALIGNMENT_LEFT:
.. rst-class:: classref-enumeration-constant
:ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **ALIGNMENT_LEFT** = ``0``
Aligns tabs to the left.
.. _class_TabBar_constant_ALIGNMENT_CENTER:
.. rst-class:: classref-enumeration-constant
:ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **ALIGNMENT_CENTER** = ``1``
Aligns tabs in the middle.
.. _class_TabBar_constant_ALIGNMENT_RIGHT:
.. rst-class:: classref-enumeration-constant
:ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **ALIGNMENT_RIGHT** = ``2``
Aligns tabs to the right.
.. _class_TabBar_constant_ALIGNMENT_MAX:
.. rst-class:: classref-enumeration-constant
:ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **ALIGNMENT_MAX** = ``3``
代表 :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` 列舉的大小。
.. rst-class:: classref-item-separator
----
.. _enum_TabBar_CloseButtonDisplayPolicy:
.. rst-class:: classref-enumeration
enum **CloseButtonDisplayPolicy**: :ref:`🔗<enum_TabBar_CloseButtonDisplayPolicy>`
.. _class_TabBar_constant_CLOSE_BUTTON_SHOW_NEVER:
.. rst-class:: classref-enumeration-constant
:ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>` **CLOSE_BUTTON_SHOW_NEVER** = ``0``
永遠不會顯示關閉按鈕。
.. _class_TabBar_constant_CLOSE_BUTTON_SHOW_ACTIVE_ONLY:
.. rst-class:: classref-enumeration-constant
:ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>` **CLOSE_BUTTON_SHOW_ACTIVE_ONLY** = ``1``
僅在目前活動分頁上顯示關閉按鈕。
.. _class_TabBar_constant_CLOSE_BUTTON_SHOW_ALWAYS:
.. rst-class:: classref-enumeration-constant
:ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>` **CLOSE_BUTTON_SHOW_ALWAYS** = ``2``
在所有分頁上顯示關閉按鈕。
.. _class_TabBar_constant_CLOSE_BUTTON_MAX:
.. rst-class:: classref-enumeration-constant
:ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>` **CLOSE_BUTTON_MAX** = ``3``
代表 :ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>` 列舉的大小。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
屬性說明
--------
.. _class_TabBar_property_clip_tabs:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **clip_tabs** = ``true`` :ref:`🔗<class_TabBar_property_clip_tabs>`
.. rst-class:: classref-property-setget
- |void| **set_clip_tabs**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_clip_tabs**\ (\ )
如果為 ``true``\ ,則會隱藏超出該節點寬度的分頁,改為顯示兩個導覽按鈕。否則,會更新該節點的最小尺寸,讓所有分頁均可見。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_close_with_middle_mouse:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **close_with_middle_mouse** = ``true`` :ref:`🔗<class_TabBar_property_close_with_middle_mouse>`
.. rst-class:: classref-property-setget
- |void| **set_close_with_middle_mouse**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_close_with_middle_mouse**\ (\ )
If ``true``, middle-clicking on a tab will emit the :ref:`tab_close_pressed<class_TabBar_signal_tab_close_pressed>` signal.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_current_tab:
.. rst-class:: classref-property
:ref:`int<class_int>` **current_tab** = ``-1`` :ref:`🔗<class_TabBar_property_current_tab>`
.. rst-class:: classref-property-setget
- |void| **set_current_tab**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_current_tab**\ (\ )
The index of the current selected tab. A value of ``-1`` means that no tab is selected and can only be set when :ref:`deselect_enabled<class_TabBar_property_deselect_enabled>` is ``true`` or if all tabs are hidden or disabled.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_deselect_enabled:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **deselect_enabled** = ``false`` :ref:`🔗<class_TabBar_property_deselect_enabled>`
.. rst-class:: classref-property-setget
- |void| **set_deselect_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_deselect_enabled**\ (\ )
If ``true``, all tabs can be deselected so that no tab is selected. Click on the current tab to deselect it.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_drag_to_rearrange_enabled:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **drag_to_rearrange_enabled** = ``false`` :ref:`🔗<class_TabBar_property_drag_to_rearrange_enabled>`
.. rst-class:: classref-property-setget
- |void| **set_drag_to_rearrange_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_drag_to_rearrange_enabled**\ (\ )
如果為 ``true``\ ,可以通過滑鼠拖動重新排列分頁。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_max_tab_width:
.. rst-class:: classref-property
:ref:`int<class_int>` **max_tab_width** = ``0`` :ref:`🔗<class_TabBar_property_max_tab_width>`
.. rst-class:: classref-property-setget
- |void| **set_max_tab_width**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_max_tab_width**\ (\ )
設定所有分頁應被限制的最大寬度。如果設定為 ``0``\ ,則無限制。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_scroll_to_selected:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **scroll_to_selected** = ``true`` :ref:`🔗<class_TabBar_property_scroll_to_selected>`
.. rst-class:: classref-property-setget
- |void| **set_scroll_to_selected**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_scroll_to_selected**\ (\ )
如果為 ``true``\ ,則會更改分頁偏移量,從而保持目前選中的分頁可見。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_scrolling_enabled:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **scrolling_enabled** = ``true`` :ref:`🔗<class_TabBar_property_scrolling_enabled>`
.. rst-class:: classref-property-setget
- |void| **set_scrolling_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_scrolling_enabled**\ (\ )
如果為 ``true``\ ,滑鼠的滾輪可用於導覽滾動視圖。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_select_with_rmb:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **select_with_rmb** = ``false`` :ref:`🔗<class_TabBar_property_select_with_rmb>`
.. rst-class:: classref-property-setget
- |void| **set_select_with_rmb**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_select_with_rmb**\ (\ )
如果為 ``true``\ ,啟用滑鼠右鍵選擇分頁。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_switch_on_drag_hover:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **switch_on_drag_hover** = ``true`` :ref:`🔗<class_TabBar_property_switch_on_drag_hover>`
.. rst-class:: classref-property-setget
- |void| **set_switch_on_drag_hover**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_switch_on_drag_hover**\ (\ )
If ``true``, hovering over a tab while dragging something will switch to that tab. Does not have effect when hovering another tab to rearrange. The delay for when this happens is dictated by :ref:`hover_switch_wait_msec<class_TabBar_theme_constant_hover_switch_wait_msec>`.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_tab_alignment:
.. rst-class:: classref-property
:ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **tab_alignment** = ``0`` :ref:`🔗<class_TabBar_property_tab_alignment>`
.. rst-class:: classref-property-setget
- |void| **set_tab_alignment**\ (\ value\: :ref:`AlignmentMode<enum_TabBar_AlignmentMode>`\ )
- :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **get_tab_alignment**\ (\ )
The horizontal alignment of the tabs.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_tab_close_display_policy:
.. rst-class:: classref-property
:ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>` **tab_close_display_policy** = ``0`` :ref:`🔗<class_TabBar_property_tab_close_display_policy>`
.. rst-class:: classref-property-setget
- |void| **set_tab_close_display_policy**\ (\ value\: :ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>`\ )
- :ref:`CloseButtonDisplayPolicy<enum_TabBar_CloseButtonDisplayPolicy>` **get_tab_close_display_policy**\ (\ )
When the close button will appear on the tabs.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_tab_count:
.. rst-class:: classref-property
:ref:`int<class_int>` **tab_count** = ``0`` :ref:`🔗<class_TabBar_property_tab_count>`
.. rst-class:: classref-property-setget
- |void| **set_tab_count**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_tab_count**\ (\ )
分頁欄中目前的分頁數量。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_property_tabs_rearrange_group:
.. rst-class:: classref-property
:ref:`int<class_int>` **tabs_rearrange_group** = ``-1`` :ref:`🔗<class_TabBar_property_tabs_rearrange_group>`
.. rst-class:: classref-property-setget
- |void| **set_tabs_rearrange_group**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_tabs_rearrange_group**\ (\ )
具有相同重新排列組 ID 的 **TabBar** 將允許在它們之間拖動分頁。使用 :ref:`drag_to_rearrange_enabled<class_TabBar_property_drag_to_rearrange_enabled>` 啟用拖動。
將該屬性設定為 ``-1`` 將禁用 **TabBar** 之間的重新排列。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法說明
--------
.. _class_TabBar_method_add_tab:
.. rst-class:: classref-method
|void| **add_tab**\ (\ title\: :ref:`String<class_String>` = "", icon\: :ref:`Texture2D<class_Texture2D>` = null\ ) :ref:`🔗<class_TabBar_method_add_tab>`
新增新分頁。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_clear_tabs:
.. rst-class:: classref-method
|void| **clear_tabs**\ (\ ) :ref:`🔗<class_TabBar_method_clear_tabs>`
清空所有分頁。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_ensure_tab_visible:
.. rst-class:: classref-method
|void| **ensure_tab_visible**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_method_ensure_tab_visible>`
移動滾動視圖,使標籤可見。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_offset_buttons_visible:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_offset_buttons_visible**\ (\ ) |const| :ref:`🔗<class_TabBar_method_get_offset_buttons_visible>`
如果偏移按鈕(所有分頁沒有足夠空間時出現的按鈕)可見,則返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_previous_tab:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_previous_tab**\ (\ ) |const| :ref:`🔗<class_TabBar_method_get_previous_tab>`
返回上一個活動分頁的索引。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_button_icon:
.. rst-class:: classref-method
:ref:`Texture2D<class_Texture2D>` **get_tab_button_icon**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_button_icon>`
返回索引 ``tab_idx`` 處分頁右側按鈕的圖示,如果該按鈕沒有圖示,則返回 ``null``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_icon:
.. rst-class:: classref-method
:ref:`Texture2D<class_Texture2D>` **get_tab_icon**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_icon>`
返回索引 ``tab_idx`` 處分頁的圖示,如果該分頁沒有圖示,則返回 ``null``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_icon_max_width:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_tab_icon_max_width**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_icon_max_width>`
設定索引為 ``tab_idx`` 處分頁所允許的最大圖示寬度。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_idx_at_point:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_tab_idx_at_point**\ (\ point\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_idx_at_point>`
返回位於局部座標 ``point`` 處的分頁的索引。如果該點在控制項邊界之外或查詢位置沒有分頁,則返回 ``-1``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_language:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_tab_language**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_language>`
返回分頁標題的語言程式碼。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_metadata:
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **get_tab_metadata**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_metadata>`
返回索引為 ``tab_idx`` 的分頁的中繼資料的值,由 :ref:`set_tab_metadata()<class_TabBar_method_set_tab_metadata>` 設定。如果之前沒有設定中繼資料,則預設返回 ``null``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_offset:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_tab_offset**\ (\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_offset>`
返回向左偏移的隱藏分頁的數量。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_rect:
.. rst-class:: classref-method
:ref:`Rect2<class_Rect2>` **get_tab_rect**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_rect>`
返回帶有局部位置和大小的分頁 :ref:`Rect2<class_Rect2>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_text_direction:
.. rst-class:: classref-method
:ref:`TextDirection<enum_Control_TextDirection>` **get_tab_text_direction**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_text_direction>`
返回分頁標題文字的基礎書寫方向。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_title:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_tab_title**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_title>`
返回索引 ``tab_idx`` 處的分頁的標題。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_get_tab_tooltip:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_tab_tooltip**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_get_tab_tooltip>`
Returns the tooltip text of the tab at index ``tab_idx``.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_is_tab_disabled:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_tab_disabled**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_is_tab_disabled>`
如果索引 ``tab_idx`` 處的分頁被禁用,則返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_is_tab_hidden:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_tab_hidden**\ (\ tab_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_TabBar_method_is_tab_hidden>`
如果索引 ``tab_idx`` 處的分頁被隱藏,則返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_move_tab:
.. rst-class:: classref-method
|void| **move_tab**\ (\ from\: :ref:`int<class_int>`, to\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_method_move_tab>`
將分頁從 ``from`` 移動到 ``to``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_remove_tab:
.. rst-class:: classref-method
|void| **remove_tab**\ (\ tab_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_method_remove_tab>`
刪除索引 ``tab_idx`` 處的分頁。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_select_next_available:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **select_next_available**\ (\ ) :ref:`🔗<class_TabBar_method_select_next_available>`
返回目前焦點專案的索引。如果沒有焦點,則返回 ``-1``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_select_previous_available:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **select_previous_available**\ (\ ) :ref:`🔗<class_TabBar_method_select_previous_available>`
返回目前焦點專案的索引。如果沒有焦點,則返回 ``-1``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_button_icon:
.. rst-class:: classref-method
|void| **set_tab_button_icon**\ (\ tab_idx\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) :ref:`🔗<class_TabBar_method_set_tab_button_icon>`
設定索引為 ``tab_idx`` 的分頁按鈕的圖示 ``icon``\ (位於右側,在關閉按鈕之前),會將該按鈕設為可見且可點擊(見 :ref:`tab_button_pressed<class_TabBar_signal_tab_button_pressed>`\ )。給定 ``null`` 值會隱藏該按鈕。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_disabled:
.. rst-class:: classref-method
|void| **set_tab_disabled**\ (\ tab_idx\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_TabBar_method_set_tab_disabled>`
如果 ``disabled````true``\ ,則禁用索引 ``tab_idx`` 處的選項卡,使其不可互動。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_hidden:
.. rst-class:: classref-method
|void| **set_tab_hidden**\ (\ tab_idx\: :ref:`int<class_int>`, hidden\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_TabBar_method_set_tab_hidden>`
如果 ``hidden````true``\ ,則隱藏索引 ``tab_idx`` 處的選項卡,使其從分頁區域消失。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_icon:
.. rst-class:: classref-method
|void| **set_tab_icon**\ (\ tab_idx\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) :ref:`🔗<class_TabBar_method_set_tab_icon>`
設定索引 ``tab_idx`` 處的分頁的圖示。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_icon_max_width:
.. rst-class:: classref-method
|void| **set_tab_icon_max_width**\ (\ tab_idx\: :ref:`int<class_int>`, width\: :ref:`int<class_int>`\ ) :ref:`🔗<class_TabBar_method_set_tab_icon_max_width>`
設定索引為 ``tab_idx`` 處分頁所允許的最大圖示寬度。這是在圖示的預設大小和 :ref:`icon_max_width<class_TabBar_theme_constant_icon_max_width>` 的基礎上的限制。高度會根據圖示的長寬比調整。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_language:
.. rst-class:: classref-method
|void| **set_tab_language**\ (\ tab_idx\: :ref:`int<class_int>`, language\: :ref:`String<class_String>`\ ) :ref:`🔗<class_TabBar_method_set_tab_language>`
Sets the language code of the title for the tab at index ``tab_idx`` to ``language``. This is used for line-breaking and text shaping algorithms. If ``language`` is empty, the current locale is used.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_metadata:
.. rst-class:: classref-method
|void| **set_tab_metadata**\ (\ tab_idx\: :ref:`int<class_int>`, metadata\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_TabBar_method_set_tab_metadata>`
``tab_idx`` 的分頁設定中繼資料的值,之後可以使用 :ref:`get_tab_metadata()<class_TabBar_method_get_tab_metadata>` 獲取。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_text_direction:
.. rst-class:: classref-method
|void| **set_tab_text_direction**\ (\ tab_idx\: :ref:`int<class_int>`, direction\: :ref:`TextDirection<enum_Control_TextDirection>`\ ) :ref:`🔗<class_TabBar_method_set_tab_text_direction>`
設定分頁標題的基礎書寫方向。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_title:
.. rst-class:: classref-method
|void| **set_tab_title**\ (\ tab_idx\: :ref:`int<class_int>`, title\: :ref:`String<class_String>`\ ) :ref:`🔗<class_TabBar_method_set_tab_title>`
設定索引 ``tab_idx`` 處的分頁的標題 ``title``\ 。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_method_set_tab_tooltip:
.. rst-class:: classref-method
|void| **set_tab_tooltip**\ (\ tab_idx\: :ref:`int<class_int>`, tooltip\: :ref:`String<class_String>`\ ) :ref:`🔗<class_TabBar_method_set_tab_tooltip>`
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.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
主題屬性說明
------------
.. _class_TabBar_theme_color_drop_mark_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **drop_mark_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_TabBar_theme_color_drop_mark_color>`
:ref:`drop_mark<class_TabBar_theme_icon_drop_mark>` 圖示的調變顏色。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_font_disabled_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **font_disabled_color** = ``Color(0.875, 0.875, 0.875, 0.5)`` :ref:`🔗<class_TabBar_theme_color_font_disabled_color>`
禁用分頁的字形顏色。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_font_hovered_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **font_hovered_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`🔗<class_TabBar_theme_color_font_hovered_color>`
目前懸停分頁的字形顏色。不適用於選中的分頁。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_font_outline_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **font_outline_color** = ``Color(0, 0, 0, 1)`` :ref:`🔗<class_TabBar_theme_color_font_outline_color>`
分頁名稱的文字輪廓的色調。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_font_selected_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **font_selected_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`🔗<class_TabBar_theme_color_font_selected_color>`
目前所選分頁的字形顏色。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_font_unselected_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **font_unselected_color** = ``Color(0.7, 0.7, 0.7, 1)`` :ref:`🔗<class_TabBar_theme_color_font_unselected_color>`
其他未被選中的分頁的字形顏色。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_icon_disabled_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **icon_disabled_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_TabBar_theme_color_icon_disabled_color>`
Icon color of disabled tabs.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_icon_hovered_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **icon_hovered_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_TabBar_theme_color_icon_hovered_color>`
Icon color of the currently hovered tab. Does not apply to the selected tab.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_icon_selected_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **icon_selected_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_TabBar_theme_color_icon_selected_color>`
Icon color of the currently selected tab.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_color_icon_unselected_color:
.. rst-class:: classref-themeproperty
:ref:`Color<class_Color>` **icon_unselected_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_TabBar_theme_color_icon_unselected_color>`
Icon color of the other, unselected tabs.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_constant_h_separation:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **h_separation** = ``4`` :ref:`🔗<class_TabBar_theme_constant_h_separation>`
分頁內元素之間的水平分隔。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_constant_hover_switch_wait_msec:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **hover_switch_wait_msec** = ``500`` :ref:`🔗<class_TabBar_theme_constant_hover_switch_wait_msec>`
During a drag-and-drop, this is how many milliseconds to wait before switching the tab.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_constant_icon_max_width:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **icon_max_width** = ``0`` :ref:`🔗<class_TabBar_theme_constant_icon_max_width>`
分頁圖示所允許的最大寬度。這個限制套用在該圖示預設大小之上,但是套用在 :ref:`set_tab_icon_max_width()<class_TabBar_method_set_tab_icon_max_width>` 所設定的值之前。高度會根據圖示比例調整。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_constant_outline_size:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **outline_size** = ``0`` :ref:`🔗<class_TabBar_theme_constant_outline_size>`
分頁文字輪廓的大小。
\ **注意:**\ 如果使用啟用了 :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` 的字形,其 :ref:`FontFile.msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` 必須至少設定為 :ref:`outline_size<class_TabBar_theme_constant_outline_size>` 的\ *兩倍*\ ,輪廓算繪才能看起來正確。否則,輪廓可能會比預期的更早被切斷。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_constant_tab_separation:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **tab_separation** = ``0`` :ref:`🔗<class_TabBar_theme_constant_tab_separation>`
The space between tabs in the tab bar.
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_font_font:
.. rst-class:: classref-themeproperty
:ref:`Font<class_Font>` **font** :ref:`🔗<class_TabBar_theme_font_font>`
用於繪製分頁名稱的字形。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_font_size_font_size:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **font_size** :ref:`🔗<class_TabBar_theme_font_size_font_size>`
分頁名稱的字形大小。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_icon_close:
.. rst-class:: classref-themeproperty
:ref:`Texture2D<class_Texture2D>` **close** :ref:`🔗<class_TabBar_theme_icon_close>`
關閉按鈕的圖示(見 :ref:`tab_close_display_policy<class_TabBar_property_tab_close_display_policy>`\ )。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_icon_decrement:
.. rst-class:: classref-themeproperty
:ref:`Texture2D<class_Texture2D>` **decrement** :ref:`🔗<class_TabBar_theme_icon_decrement>`
左邊的箭頭按鈕的圖示,當有太多的標籤無法容納在容器的寬度內時出現。當該按鈕被禁用時(即第一個標籤是可見的),它顯示為半透明的。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_icon_decrement_highlight:
.. rst-class:: classref-themeproperty
:ref:`Texture2D<class_Texture2D>` **decrement_highlight** :ref:`🔗<class_TabBar_theme_icon_decrement_highlight>`
當標籤太多無法適應容器寬度時出現的左箭頭按鈕圖示。當滑鼠懸停在按鈕上時使用。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_icon_drop_mark:
.. rst-class:: classref-themeproperty
:ref:`Texture2D<class_Texture2D>` **drop_mark** :ref:`🔗<class_TabBar_theme_icon_drop_mark>`
圖示,用於指示拖動的分頁將被放置到哪裡(見 :ref:`drag_to_rearrange_enabled<class_TabBar_property_drag_to_rearrange_enabled>`\ )。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_icon_increment:
.. rst-class:: classref-themeproperty
:ref:`Texture2D<class_Texture2D>` **increment** :ref:`🔗<class_TabBar_theme_icon_increment>`
右箭頭按鈕的圖示,當有太多的標籤無法容納在容器的寬度內時出現。當該按鈕被禁用時(即最後一個標籤是可見的),它顯示為半透明的。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_icon_increment_highlight:
.. rst-class:: classref-themeproperty
:ref:`Texture2D<class_Texture2D>` **increment_highlight** :ref:`🔗<class_TabBar_theme_icon_increment_highlight>`
當標籤太多無法適應容器寬度時出現的右箭頭按鈕圖示。當滑鼠懸停在按鈕上時使用。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_style_button_highlight:
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` **button_highlight** :ref:`🔗<class_TabBar_theme_style_button_highlight>`
分頁和關閉按鈕的背景,處於滑鼠懸停狀態時使用。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_style_button_pressed:
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` **button_pressed** :ref:`🔗<class_TabBar_theme_style_button_pressed>`
分頁和關閉按鈕的背景,處於按下狀態時使用。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_style_tab_disabled:
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` **tab_disabled** :ref:`🔗<class_TabBar_theme_style_tab_disabled>`
分頁處於禁用狀態時的樣式。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_style_tab_focus:
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` **tab_focus** :ref:`🔗<class_TabBar_theme_style_tab_focus>`
:ref:`Button<class_Button>` 處於聚焦狀態時使用的 :ref:`StyleBox<class_StyleBox>`\ 。\ ``focus`` :ref:`StyleBox<class_StyleBox>` 顯示在基礎 :ref:`StyleBox<class_StyleBox>` *之上*\ ,所以應該使用部分透明的 :ref:`StyleBox<class_StyleBox>`\ ,確保基礎 :ref:`StyleBox<class_StyleBox>` 仍然可見。代表輪廓或底線的 :ref:`StyleBox<class_StyleBox>` 可以很好地實作這個目的。要禁用聚焦的視覺效果,請指定 :ref:`StyleBoxEmpty<class_StyleBoxEmpty>` 資源。請注意,禁用聚焦的視覺效果會影響使用鍵盤/手柄進行導覽的可用性,所以出於可存取性的原因,不建議這樣做。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_style_tab_hovered:
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` **tab_hovered** :ref:`🔗<class_TabBar_theme_style_tab_hovered>`
目前懸停分頁的樣式。不適用於所選分頁。
\ **注意:**\ 此樣式將至少以與\ :ref:`tab_unselected<class_TabBar_theme_style_tab_unselected>`\ 相同的寬度繪製。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_style_tab_selected:
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` **tab_selected** :ref:`🔗<class_TabBar_theme_style_tab_selected>`
目前選中的分頁的樣式。
.. rst-class:: classref-item-separator
----
.. _class_TabBar_theme_style_tab_unselected:
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` **tab_unselected** :ref:`🔗<class_TabBar_theme_style_tab_unselected>`
其他未被選中的分頁的樣式。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
.. |void| replace:: :abbr:`void (無回傳值。)`