Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Tree

繼承: Control < CanvasItem < Node < Object

用於以層級結構顯示一組內部 TreeItem 的控制項。

說明

用於以層級結構顯示一組內部 TreeItem 的控制項。樹狀項目可以選擇、展開、折疊。該樹可以有多欄自訂控制項,如 LineEdit、按鈕和快顯視窗。對於結構化顯示和互動很有用。

樹通過程式碼建立,使用 TreeItem 物件來建構結構。根項目只有一個,但可以使用 hide_root 來模擬多個根項目。

func _ready():
    var tree = Tree.new()
    var root = tree.create_item()
    tree.hide_root = true
    var child1 = tree.create_item(root)
    var child2 = tree.create_item(root)
    var subchild1 = tree.create_item(child1)
    subchild1.set_text(0, "Subchild1")

要走訪 Tree 物件中的所有 TreeItem 物件,請在通過 get_root() 獲得根項目之後,使用 TreeItem.get_next() 和 TreeItem.get_first_child() 方法。你可以對 TreeItem 使用 Object.free() 來把它從 Tree 中移除。

漸進式搜尋:與 ItemList 和 PopupMenu 類似,Tree 也支援在聚焦控制項時在清單中進行搜尋。按下與某個條目名稱第一個字母一致的按鍵,就會選中以該字母開頭的第一個條目。在此之後,進行漸進式搜尋的辦法有兩種:1)在逾時前再次按下同一個按鍵,選中以該字母開頭的下一個條目。2)在逾時前按下剩餘字母對應的按鍵,直接配對並選中所需的條目。這兩個動作都會在最後一次按鍵逾時後重設回清單頂端。你可以通過 ProjectSettings.gui/timers/incremental_search_max_interval_msec 修改逾時時長。

屬性

bool

allow_reselect

false

bool

allow_rmb_select

false

bool

allow_search

true

bool

auto_tooltip

true

bool

clip_contents

true (overrides Control)

bool

column_titles_visible

false

int

columns

1

int

drop_mode_flags

0

bool

enable_drag_unfolding

true

bool

enable_recursive_folding

true

FocusMode

focus_mode

2 (overrides Control)

bool

hide_folding

false

bool

hide_root

false

ScrollHintMode

scroll_hint_mode

0

bool

scroll_horizontal_enabled

true

bool

scroll_vertical_enabled

true

SelectMode

select_mode

0

bool

tile_scroll_hint

false

方法

void

clear()

TreeItem

create_item(parent: TreeItem = null, index: int = -1)

void

deselect_all()

bool

edit_selected(force_edit: bool = false)

void

ensure_cursor_is_visible()

int

get_button_id_at_position(position: Vector2) const

int

get_column_at_position(position: Vector2) const

int

get_column_expand_ratio(column: int) const

String

get_column_title(column: int) const

HorizontalAlignment

get_column_title_alignment(column: int) const

TextDirection

get_column_title_direction(column: int) const

String

get_column_title_language(column: int) const

String

get_column_title_tooltip_text(column: int) const

int

get_column_width(column: int) const

RID

get_custom_drawing_canvas_item() const

Rect2

get_custom_popup_rect() const

int

get_drop_section_at_position(position: Vector2) const

TreeItem

get_edited() const

int

get_edited_column() const

Rect2

get_item_area_rect(item: TreeItem, column: int = -1, button_index: int = -1) const

TreeItem

get_item_at_position(position: Vector2) const

TreeItem

get_next_selected(from: TreeItem)

int

get_pressed_button() const

TreeItem

get_root() const

Vector2

get_scroll() const

TreeItem

get_selected() const

int

get_selected_column() const

bool

is_column_clipping_content(column: int) const

bool

is_column_expanding(column: int) const

void

scroll_to_item(item: TreeItem, center_on_item: bool = false)

void

set_column_clip_content(column: int, enable: bool)

void

set_column_custom_minimum_width(column: int, min_width: int)

void

set_column_expand(column: int, expand: bool)

void

set_column_expand_ratio(column: int, ratio: int)

void

set_column_title(column: int, title: String)

void

set_column_title_alignment(column: int, title_alignment: HorizontalAlignment)

void

set_column_title_direction(column: int, direction: TextDirection)

void

set_column_title_language(column: int, language: String)

void

set_column_title_tooltip_text(column: int, tooltip_text: String)

void

set_selected(item: TreeItem, column: int)

主題屬性

Color

children_hl_line_color

Color(0.27, 0.27, 0.27, 1)

Color

custom_button_font_highlight

Color(0.95, 0.95, 0.95, 1)

Color

drop_on_item_color

Color(1, 1, 1, 1)

Color

drop_position_color

Color(1, 1, 1, 1)

Color

font_color

Color(0.7, 0.7, 0.7, 1)

Color

font_disabled_color

Color(0.875, 0.875, 0.875, 0.5)

Color

font_hovered_color

Color(0.95, 0.95, 0.95, 1)

Color

font_hovered_dimmed_color

Color(0.875, 0.875, 0.875, 1)

Color

font_hovered_selected_color

Color(1, 1, 1, 1)

Color

font_outline_color

Color(0, 0, 0, 1)

Color

font_selected_color

Color(1, 1, 1, 1)

Color

guide_color

Color(0.7, 0.7, 0.7, 0.25)

Color

parent_hl_line_color

Color(0.27, 0.27, 0.27, 1)

Color

relationship_line_color

Color(0.27, 0.27, 0.27, 1)

Color

scroll_hint_color

Color(0, 0, 0, 1)

Color

title_button_color

Color(0.875, 0.875, 0.875, 1)

int

button_margin

4

int

check_h_separation

4

int

children_hl_line_width

1

int

dragging_unfold_wait_msec

500

int

draw_guides

1

int

draw_relationship_lines

0

int

h_separation

4

int

icon_h_separation

4

int

icon_max_width

0

int

inner_item_margin_bottom

0

int

inner_item_margin_left

0

int

inner_item_margin_right

0

int

inner_item_margin_top

0

int

item_margin

16

int

outline_size

0

int

parent_hl_line_margin

0

int

parent_hl_line_width

1

int

relationship_line_width

1

int

scroll_border

4

int

scroll_speed

12

int

scrollbar_h_separation

4

int

scrollbar_margin_bottom

-1

int

scrollbar_margin_left

-1

int

scrollbar_margin_right

-1

int

scrollbar_margin_top

-1

int

scrollbar_v_separation

4

int

v_separation

4

Font

font

Font

title_button_font

int

font_size

int

title_button_font_size

Texture2D

arrow

Texture2D

arrow_collapsed

Texture2D

arrow_collapsed_mirrored

Texture2D

checked

Texture2D

checked_disabled

Texture2D

indeterminate

Texture2D

indeterminate_disabled

Texture2D

scroll_hint

Texture2D

select_arrow

Texture2D

unchecked

Texture2D

unchecked_disabled

Texture2D

updown

StyleBox

button_hover

StyleBox

button_pressed

StyleBox

cursor

StyleBox

cursor_unfocused

StyleBox

custom_button

StyleBox

custom_button_hover

StyleBox

custom_button_pressed

StyleBox

focus

StyleBox

hovered

StyleBox

hovered_dimmed

StyleBox

hovered_selected

StyleBox

hovered_selected_focus

StyleBox

panel

StyleBox

selected

StyleBox

selected_focus

StyleBox

title_button_hover

StyleBox

title_button_normal

StyleBox

title_button_pressed


訊號

button_clicked(item: TreeItem, column: int, id: int, mouse_button_index: int) 🔗

按下樹中的某個按鈕時發出(見 TreeItem.add_button())。


cell_selected() 🔗

選中某個儲存格時發出。


check_propagated_to_item(item: TreeItem, column: int) 🔗

呼叫 TreeItem.propagate_check() 時發出。連接到該訊號可以處理在 TreeItem.propagate_check() 被呼叫時受影響的項。受影響項的處理順序如下:呼叫該方法的項,該項的子項,最後是該項的父項。


column_title_clicked(column: int, mouse_button_index: int) 🔗

使用 @GlobalScope.MOUSE_BUTTON_LEFT 使用 @GlobalScope.MOUSE_BUTTON_RIGHT 點選某一列的標題時發出。


custom_item_clicked(mouse_button_index: int) 🔗

使用滑鼠按鈕點選某一 TreeItem.CELL_MODE_CUSTOM 項時發出。


custom_popup_edited(arrow_clicked: bool) 🔗

點選某一 TreeItem.CELL_MODE_CUSTOM 項進行編輯時發出。


empty_clicked(click_position: Vector2, mouse_button_index: int) 🔗

使用滑鼠按鈕點選該樹中的空白區域時發出。


item_activated() 🔗

雙擊某一項,或使用 ui_accept 輸入事件(例如鍵盤的確認或空格鍵)選中某一項時發出。


item_collapsed(item: TreeItem) 🔗

點選折疊箭頭或通過程式碼對某一項進行展開或折疊操作時發出。

注意:雖然命名如此,展開項目時也會發出該訊號。


item_edited() 🔗

編輯某一項時發出。


item_icon_double_clicked() 🔗

雙擊某一項的圖示時發出。雙擊該項的任意區域所發出的訊號見 item_activated。


item_mouse_selected(mouse_position: Vector2, mouse_button_index: int) 🔗

使用滑鼠按鈕選中某一項時發出。


item_selected() 🔗

選中某一項時發出。


multi_selected(item: TreeItem, column: int, selected: bool) 🔗

如果 select_mode 被設定為 SELECT_MULTI,則代替 item_selected 發出。


nothing_selected() 🔗

滑鼠左鍵未選中任一項時發出。


列舉

enum SelectMode: 🔗

SelectMode SELECT_SINGLE = 0

允許一次選擇一個儲存格。從項的角度看,只允許選擇一個項。而且在所選項中只有一列被選中。

在這種模式下,焦點游標總被隱藏,被定位在目前的選擇處,使目前的選擇項成為目前的焦點項。

SelectMode SELECT_ROW = 1

允許一次選擇單行。從項的角度看,只允許選擇單個項。而所有的列都被選擇在所選項中。

在這種模式下,焦點游標總被隱藏,被定位在目前選擇的第一列,使目前選擇項成為目前焦點項。

SelectMode SELECT_MULTI = 2

允許同時選擇多個儲存格。從項的角度看,允許選擇多個項。而且每個被選中的項中可以有多個列被選中。

在這種模式下,焦點游標可見,游標下的項或列不一定被選中。


enum DropModeFlags: 🔗

DropModeFlags DROP_MODE_DISABLED = 0

停用所有放置部分。

注意:這是預設標誌,與其他標誌組合使用時無效。

DropModeFlags DROP_MODE_ON_ITEM = 1

啟用“項目上”的放置部分。這個放置部分覆蓋整個項。

當與 DROP_MODE_INBETWEEN 結合使用時,這個放置部分的高度減半,並保持垂直居中。

DropModeFlags DROP_MODE_INBETWEEN = 2

啟用“項目上方”和“項目下方”的放置部分。“項目上方”的放置部分覆蓋項目的上半部分,“項目下方”的放置部分覆蓋下半部分,並向下延伸至所有子元素的左側。

當與 DROP_MODE_ON_ITEM 結合使用時,這些放置部分的高度減半,並相應地停留在頂部或底部。


enum ScrollHintMode: 🔗

ScrollHintMode SCROLL_HINT_MODE_DISABLED = 0

捲動提示將永遠不會顯示。

ScrollHintMode SCROLL_HINT_MODE_BOTH = 1

捲動提示將顯示在頂部和底部。

ScrollHintMode SCROLL_HINT_MODE_TOP = 2

只會顯示頂部的捲動提示。

ScrollHintMode SCROLL_HINT_MODE_BOTTOM = 3

只會顯示底部的捲動提示。


屬性說明

bool allow_reselect = false 🔗

  • void set_allow_reselect(value: bool)

  • bool get_allow_reselect()

如果為 true,可以再次選擇目前選定的單元。


bool allow_rmb_select = false 🔗

  • void set_allow_rmb_select(value: bool)

  • bool get_allow_rmb_select()

如果為 true,滑鼠右鍵點選可以選擇專案。


  • void set_allow_search(value: bool)

  • bool get_allow_search()

如果為 true,允許在 Tree 中以差異量搜尋的形式使用字母鍵導覽。


bool auto_tooltip = true 🔗

  • void set_auto_tooltip(value: bool)

  • bool is_auto_tooltip_enabled()

如果為 true,則未分配工具提示的樹項目會使用其文字屬性作為工具提示。另見 TreeItem.get_tooltip_text() 和 TreeItem.get_button_tooltip_text()。


bool column_titles_visible = false 🔗

  • void set_column_titles_visible(value: bool)

  • bool are_column_titles_visible()

如果為 true,列標題可見。


int columns = 1 🔗

  • void set_columns(value: int)

  • int get_columns()

列的數量。

在滑鼠選擇期間設定列時會輸出錯誤且不被允許。


int drop_mode_flags = 0 🔗

  • void set_drop_mode_flags(value: int)

  • int get_drop_mode_flags()

放置模式是旗標的按位元或(OR)組合。見 DropModeFlags 常數。放置完成後會恢復為 DROP_MODE_DISABLED。建議在 Control._can_drop_data() 期間設定。

控制的是放置區,即根據滑鼠的位置決定並繪製可能的放置位置。


bool enable_drag_unfolding = true 🔗

  • void set_enable_drag_unfolding(value: bool)

  • bool is_drag_unfolding_enabled()

如果為 true,則在拖放過程中,當滑鼠懸停在樹項目上時,樹項目將會展開。該操作的延遲時間由 dragging_unfold_wait_msec 決定。


bool enable_recursive_folding = true 🔗

  • void set_enable_recursive_folding(value: bool)

  • bool is_recursive_folding_enabled()

如果為 true,則該 Tree 啟用了遞歸折疊。按住 Shift 鍵點選折疊箭頭或使用快捷鍵 ui_right/ui_left 會折疊或展開該 TreeItem 及所有子項。


bool hide_folding = false 🔗

  • void set_hide_folding(value: bool)

  • bool is_folding_hidden()

如果為 true,隱藏折疊箭頭。


bool hide_root = false 🔗

  • void set_hide_root(value: bool)

  • bool is_root_hidden()

如果為 true,則隱藏樹的根節點。


ScrollHintMode scroll_hint_mode = 0 🔗

捲動提示(指示內容仍可沿特定方向捲動的指示器)的顯示方式。


bool scroll_horizontal_enabled = true 🔗

  • void set_h_scroll_enabled(value: bool)

  • bool is_h_scroll_enabled()

如果為 true,啟用水平捲動。


bool scroll_vertical_enabled = true 🔗

  • void set_v_scroll_enabled(value: bool)

  • bool is_v_scroll_enabled()

如果為 true,則啟用垂直捲動。


SelectMode select_mode = 0 🔗

允許單選或多選。見 SelectMode 常數。


bool tile_scroll_hint = false 🔗

  • void set_tile_scroll_hint(value: bool)

  • bool is_scroll_hint_tiled()

如果為 true,則捲動提示紋理將平鋪而不是拉伸。見 scroll_hint_mode。


方法說明

void clear() 🔗

清空樹。這將移除所有項目。

如果在滑鼠選擇期間呼叫該方法,則會輸出錯誤並禁止清空樹。


TreeItem create_item(parent: TreeItem = null, index: int = -1) 🔗

在樹狀結構中建立項目,並將它加入 parent 的子項目;父項目可為有效的 TreeItem,也可以是 null。

若 parent 為 null,則以根項目作為父項目;若樹狀結構為空,則新項目本身成為根項目。

新項目會成為父項目的第 index 個子項目;若同層項目數量不足,則加入至最後。

若在滑鼠選取操作期間呼叫,或 parent 不屬於此樹狀結構,則會輸出錯誤並回傳 null。


void deselect_all() 🔗

取消選中樹中的所有專案(行和列)。在 SELECT_MULTI 模式中還會移除選擇游標。


bool edit_selected(force_edit: bool = false) 🔗

編輯選中的樹項,就像它被點選一樣。

該項必須通過 TreeItem.set_editable() 設定為可編輯,否則 force_edit 必須為 true。

如果該項可被編輯,則返回 true。如果沒有選中任何項則失敗。


void ensure_cursor_is_visible() 🔗

使目前獲得焦點的單元可見。

如果有必要,將捲動樹。在 SELECT_ROW 模式下,不會做水平捲動,因為所選行中的所有單元都按邏輯獲得焦點。

注意:儘管這個方法的名稱是這樣的,但焦點游標本身只在 SELECT_MULTI 模式下可見。


int get_button_id_at_position(position: Vector2) const 🔗

返回位於 position 的按鈕 ID,如果沒有按鈕則返回 -1。


int get_column_at_position(position: Vector2) const 🔗

返回位於 position 的列索引,如果沒有專案則返回 -1。


int get_column_expand_ratio(column: int) const 🔗

返回分配給該列的擴充比例。


String get_column_title(column: int) const 🔗

返回該列的標題。


HorizontalAlignment get_column_title_alignment(column: int) const 🔗

返回該列的標題對齊方式。


TextDirection get_column_title_direction(column: int) const 🔗

返回列標題的基礎書寫方向。


String get_column_title_language(column: int) const 🔗

返回列標題的語言程式碼。


String get_column_title_tooltip_text(column: int) const 🔗

回傳列標題的工具提示文字。


int get_column_width(column: int) const 🔗

返回列的寬度,單位是圖元。


RID get_custom_drawing_canvas_item() const 🔗

回傳用於自訂繪製的內部畫布項。請參閱 TreeItem.set_custom_draw_callback()。

注意: 該畫布項會在每次 Tree 繪製呼叫時自動清除。


Rect2 get_custom_popup_rect() const 🔗

返回自訂快顯視窗的矩形。説明建立顯示彈出式的自訂儲存格控制項。見 TreeItem.set_cell_mode()。


int get_drop_section_at_position(position: Vector2) const 🔗

回傳 position 處的放置部分,如啟用 DropModeFlags 所允許的那樣。

  • -1 如果位置在該項之上。通常用作該項的上一個同級項插入。

  • 0 如果位置在該項處。通常用作項目的最後一個子項插入。

  • 1 如果位置在該項之下,且該項沒有子項。通常用作該項的下一個同級項插入。如果該項有子項,則仍可通過將滑鼠懸停在該項折疊箭頭的左側和下方來存取該部分。

  • 2 如果位置在該項之下,且該項有子項。通常用作該項的第一個子項插入。

  • -100 如果位置不在任何項上,或者沒有設定 DropModeFlags。

有關每個放置區域的說明,請參閱 DropModeFlags。要取得回傳的放置部分所指向的項目,請使用 get_item_at_position()。


TreeItem get_edited() const 🔗

返回目前編輯的項。可以與 item_edited 一起使用以取得被修改的項。

func _ready():
    $Tree.item_edited.connect(on_Tree_item_edited)

func on_Tree_item_edited():
    print($Tree.get_edited()) # 該項剛剛被編輯(例如被勾選)。

int get_edited_column() const 🔗

返回目前編輯項的列。


Rect2 get_item_area_rect(item: TreeItem, column: int = -1, button_index: int = -1) const 🔗

返回指定 TreeItem 的矩形區域。如果指定了column,則只取得該列的位置和大小,否則取得包含所有列的矩形。如果指定了按鈕索引,則將返回該按鈕的矩形。


TreeItem get_item_at_position(position: Vector2) const 🔗

返回指定位置,即相對於樹的原點位置的樹中項。


TreeItem get_next_selected(from: TreeItem) 🔗

返回給定的 TreeItem 之後的下一個選中項,如果到達末尾,則返回 null。

如果 from 為 null,則將返回第一個被選中的項。


int get_pressed_button() const 🔗

返回最後按下的按鈕的索引。


TreeItem get_root() const 🔗

返回樹的根項,如果樹是空的,則返回 null。


Vector2 get_scroll() const 🔗

返回目前的捲動位置。


TreeItem get_selected() const 🔗

返回目前的焦點項,如果沒有焦點項,則返回 null。

在 SELECT_ROW 和 SELECT_SINGLE 模式下,焦點項與選擇項相同。在 SELECT_MULTI 模式下,焦點項是焦點游標下的專案,不一定被選中。

要獲得目前選中項,請使用 get_next_selected()。


int get_selected_column() const 🔗

返回目前獲得焦點的列,如果沒有焦點列,則返回 -1。

在 SELECT_SINGLE 模式下,焦點列是被選中的列。在 SELECT_ROW 模式下,如果有任意項被選中,焦點列總是 0。在 SELECT_MULTI 模式下,焦點列是焦點游標下的列,但不一定有列被選中。

要判斷一個項的某一列是否被選中,請使用 TreeItem.is_selected()。


bool is_column_clipping_content(column: int) const 🔗

如果該列啟用了裁剪,則返回 true(見 set_column_clip_content())。


bool is_column_expanding(column: int) const 🔗

如果該列啟用了擴充,則返回 true(見 set_column_expand())。


void scroll_to_item(item: TreeItem, center_on_item: bool = false) 🔗

使 Tree 跳轉到指定的 TreeItem。


void set_column_clip_content(column: int, enable: bool) 🔗

允許對列的內容進行裁剪,會忽略內容大小。


void set_column_custom_minimum_width(column: int, min_width: int) 🔗

覆蓋某一列的計算的最小寬度。它可以被設定為 0 以恢復預設行為。具有“擴充”旗標的列將以與 Control.size_flags_stretch_ratio 類似的方式使用它們的最小寬度“min_width”。


void set_column_expand(column: int, expand: bool) 🔗

如果為 true,該列將具有 Control 的“Expand”旗標。具有“Expand”標志的列將以與 Control.size_flags_stretch_ratio 類似的方式,使用它們的擴充比率(參見 set_column_expand_ratio())。


void set_column_expand_ratio(column: int, ratio: int) 🔗

設定列的相對擴充比。見 set_column_expand()。


void set_column_title(column: int, title: String) 🔗

設定某一列的標題。


void set_column_title_alignment(column: int, title_alignment: HorizontalAlignment) 🔗

設定列標題的對齊方式。注意,列標題不支援 @GlobalScope.HORIZONTAL_ALIGNMENT_FILL。


void set_column_title_direction(column: int, direction: TextDirection) 🔗

設定列標題的基礎書寫方向。


void set_column_title_language(column: int, language: String) 🔗

將給定 column 的標題的語言程式碼設定為 language。用於斷行和文字塑形算法。如果 language 為空,則使用目前區域設定。


void set_column_title_tooltip_text(column: int, tooltip_text: String) 🔗

設定列標題的工具提示文字。


void set_selected(item: TreeItem, column: int) 🔗

選中指定的 TreeItem 和列。


主題屬性說明

Color children_hl_line_color = Color(0.27, 0.27, 0.27, 1) 🔗

被選中的 TreeItem 與其子項之間的關係線的 Color。


Color custom_button_font_highlight = Color(0.95, 0.95, 0.95, 1) 🔗

當 TreeItem.CELL_MODE_CUSTOM 模式的儲存格被懸停時的文字 Color 顏色。


Color drop_on_item_color = Color(1, 1, 1, 1) 🔗

用於繪製可拖動項目(只能放置在其他項目之上)的醒目標示輪廓的 Color。


Color drop_position_color = Color(1, 1, 1, 1) 🔗

用於繪製可能的放置位置的 Color 顏色。有關放置位置的描述,參閱 DropModeFlags 常數。


Color font_color = Color(0.7, 0.7, 0.7, 1) 🔗

專案的預設文字顏色 Color。


Color font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) 🔗

當不可編輯時,TreeItem.CELL_MODE_CHECK 模式單元格的文字 Color(請參閱 TreeItem.set_editable())。


Color font_hovered_color = Color(0.95, 0.95, 0.95, 1) 🔗

專案處於懸停但未選中狀態時使用的文字 Color。


Color font_hovered_dimmed_color = Color(0.875, 0.875, 0.875, 1) 🔗

項目處於懸停狀態且該項目的某個按鈕也同時處於懸停狀態時使用的文字顏色 Color。


Color font_hovered_selected_color = Color(1, 1, 1, 1) 🔗

項目處於懸停且已選中狀態時使用的文字 Color。


Color font_outline_color = Color(0, 0, 0, 1) 🔗

專案文字輪廓的色調。


Color font_selected_color = Color(1, 1, 1, 1) 🔗

選擇專案時使用的文字顏色 Color。


Color guide_color = Color(0.7, 0.7, 0.7, 0.25) 🔗

輔助線的 Color 顏色。


Color parent_hl_line_color = Color(0.27, 0.27, 0.27, 1) 🔗

被選中的 TreeItem 與其父項之間的關係線的 Color。


Color relationship_line_color = Color(0.27, 0.27, 0.27, 1) 🔗

關係線的預設 Color。


Color scroll_hint_color = Color(0, 0, 0, 1) 🔗

用於調制 scroll_hint 紋理的 Color。


Color title_button_color = Color(0.875, 0.875, 0.875, 1) 🔗

標題按鈕的預設文字 Color 顏色。


int button_margin = 4 🔗

儲存格中按鈕之間的水平間距。


int check_h_separation = 4 🔗

在 TreeItem.CELL_MODE_CHECK 模式的單元格中,核取方塊和文字之間的水平間距。


int children_hl_line_width = 1 🔗

被選中的 TreeItem 與其子項之間的關係線的寬度。


int dragging_unfold_wait_msec = 500 🔗

在拖放期間,這表示在展開某個部分之前,需要等待多少毫秒。


int draw_guides = 1 🔗

如果不為零就繪製輔助線,行為類似於布林值。輔助線是在每個項的底部畫的一條水平線。


int draw_relationship_lines = 0 🔗

如果不為零就繪製關係線,行為類似於布林值。關係線在子項的開始處繪製,以顯示層次結構。


int h_separation = 4 🔗

專案單元之間的水平空間。這也用作停用折疊時專案開頭的邊距。


int icon_h_separation = 4 🔗

項目的單元格中圖示和文字之間的水平間距。


int icon_max_width = 0 🔗

專案儲存格所允許的最大圖示寬度。這是在圖示預設大小的基礎上的限制,在 TreeItem.set_icon_max_width() 所設定的值之前生效。高度會根據圖示的長寬比調整。


int inner_item_margin_bottom = 0 🔗

單元格底部的內邊距。


int inner_item_margin_left = 0 🔗

單元格左側的內邊距。


int inner_item_margin_right = 0 🔗

單元格右側的內邊距。


int inner_item_margin_top = 0 🔗

單元格頂部的內邊距。


int item_margin = 16 🔗

專案開頭的水平邊距。在專案啟用折疊功能時使用。


int outline_size = 0 🔗

文字輪廓的大小。

注意:如果使用啟用了 FontFile.multichannel_signed_distance_field 的字形,其 FontFile.msdf_pixel_range 必須至少設定為 outline_size 的兩倍,輪廓渲染才能看起來正確。否則,輪廓可能會比預期的更早被切斷。


int parent_hl_line_margin = 0 🔗

被選中的 TreeItem 的父關係線,與其未選中的同級的關係線,兩者之間的空間。


int parent_hl_line_width = 1 🔗

被選中的 TreeItem 與其父項之間的關係線的寬度。


int relationship_line_width = 1 🔗

關係線的預設寬度。


int scroll_border = 4 🔗

拖動時,滑鼠指標與控制項邊框之間觸發邊框捲動的最大距離。


int scroll_speed = 12 🔗

邊框捲動的速度。


int scrollbar_h_separation = 4 🔗

樹中內容與捲軸的水平間距。


int scrollbar_margin_bottom = -1 🔗

捲軸的底部邊距。為負數時會使用 panel 的底部邊距。


int scrollbar_margin_left = -1 🔗

水平捲軸的左側邊距。為負數時會使用 panel 的左側邊距。


int scrollbar_margin_right = -1 🔗

捲軸的右側邊距。為負數時會使用 panel 的右側邊距。


int scrollbar_margin_top = -1 🔗

垂直捲動條的右側邊距。為負數時會使用 panel 的頂部邊距。


int scrollbar_v_separation = 4 🔗

樹中內容與捲軸的垂直間距。


int v_separation = 4 🔗

每個項內的垂直填充,即項內容與上或下邊框之間的距離。


Font font 🔗

專案文字的字形 Font 。


Font title_button_font 🔗

標題按鈕文字的 Font 字形。


int font_size 🔗

專案文字的字形大小。


int title_button_font_size 🔗

標題按鈕文字的 Font 字形。


Texture2D arrow 🔗

箭頭圖示,可折疊項未折疊時使用。


Texture2D arrow_collapsed 🔗

箭頭圖示,可折疊項已折疊時使用(用於從左至右佈局)。


Texture2D arrow_collapsed_mirrored 🔗

箭頭圖示,可折疊項已折疊時使用(用於從右至左佈局)。


Texture2D checked 🔗

復選圖示,模式為 TreeItem.CELL_MODE_CHECK 的單元格處於勾選狀態並且可編輯時顯示(見 TreeItem.set_editable())。


Texture2D checked_disabled 🔗

復選圖示,模式為 TreeItem.CELL_MODE_CHECK 的單元格處於勾選狀態並且不可編輯時顯示(見 TreeItem.set_editable())。


Texture2D indeterminate 🔗

復選圖示,模式為 TreeItem.CELL_MODE_CHECK 的單元格處於中間狀態並且可編輯時顯示(見 TreeItem.set_editable())。


Texture2D indeterminate_disabled 🔗

復選圖示,模式為 TreeItem.CELL_MODE_CHECK 的單元格處於中間狀態並且不可編輯時顯示(見 TreeItem.set_editable())。


Texture2D scroll_hint 🔗

內容仍可捲動時將顯示的指示器。見 scroll_hint_mode。


Texture2D select_arrow 🔗

箭頭圖示,模式為 TreeItem.CELL_MODE_RANGE 的儲存格顯示。


Texture2D unchecked 🔗

復選圖示,模式為 TreeItem.CELL_MODE_CHECK 的單元格處於未選中狀態並且可編輯時顯示(見 TreeItem.set_editable())。


Texture2D unchecked_disabled 🔗

復選圖示,模式為 TreeItem.CELL_MODE_CHECK 的單元格處於未選中狀態並且不可編輯時顯示(見 TreeItem.set_editable())。


Texture2D updown 🔗

上下箭頭圖示,模式為 TreeItem.CELL_MODE_RANGE 的儲存格顯示。


StyleBox button_hover 🔗

樹中的按鈕處於懸停狀態時使用的 StyleBox。


StyleBox button_pressed 🔗

樹中的按鈕處於按下狀態時使用的 StyleBox。


StyleBox cursor 🔗

用作游標的 StyleBox,該 Tree 處於聚焦狀態時使用。


StyleBox cursor_unfocused 🔗

用作游標的 StyleBox,該 Tree 處於失焦狀態時使用。


StyleBox custom_button 🔗

當使用 TreeItem.set_custom_as_button() 啟用按鈕時,TreeItem.CELL_MODE_CUSTOM 模式單元格的預設 StyleBox。


StyleBox custom_button_hover 🔗

模式為 TreeItem.CELL_MODE_CUSTOM 的按鈕單元格處於懸停狀態時的 StyleBox。


StyleBox custom_button_pressed 🔗

模式為 TreeItem.CELL_MODE_CUSTOM 的按鈕單元格處於按下狀態時的 StyleBox。


StyleBox focus 🔗

該 Tree 的聚焦樣式,繪製在所有東西之上。


StyleBox hovered 🔗

項目處於懸停但未選中狀態時的 StyleBox。


StyleBox hovered_dimmed 🔗

項目處於懸停狀態且該項目的某個按鈕也同時處於懸停狀態時使用的 StyleBox。


StyleBox hovered_selected 🔗

項目處於懸停且選中狀態時的 StyleBox,在 Tree 未獲得焦點時使用。


StyleBox hovered_selected_focus 🔗

項目處於懸停且選中狀態時的 StyleBox,在 Tree 獲得焦點時使用。


StyleBox panel 🔗

該 Tree 的背景樣式。


StyleBox selected 🔗

所選專案的 StyleBox,在 Tree 沒有獲得焦點時使用。


StyleBox selected_focus 🔗

所選專案的 StyleBox,在 Tree 獲得焦點時使用。


StyleBox title_button_hover 🔗

當標題按鈕被懸停時使用的 StyleBox。


StyleBox title_button_normal 🔗

標題按鈕的預設 StyleBox。


StyleBox title_button_pressed 🔗

當標題按鈕被按下時使用的 StyleBox。