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.
Checking the stable version of the documentation...
Container
繼承: Control < CanvasItem < Node < Object
被繼承: AspectRatioContainer, BoxContainer, CenterContainer, EditorProperty, FlowContainer, FoldableContainer, GraphElement, GridContainer, MarginContainer, PanelContainer, ScrollContainer, SplitContainer, SubViewportContainer, TabContainer
所有 GUI 容器的基底類別。
說明
所有 GUI 容器的基礎節點。Container 包含其他控制項,並自動以某種方式排列它們。可以繼承此類來生成自訂的容器類。
教學
屬性
|
||
mouse_filter |
|
|
propagate_maximum_size |
|
方法
_get_allowed_size_flags_horizontal() virtual const |
|
_get_allowed_size_flags_vertical() virtual const |
|
void |
fit_child_in_rect(child: Control, rect: Rect2) |
void |
訊號
pre_sort_children() 🔗
子節點將要被排序時發出。
sort_children() 🔗
需要對子節點進行排序時發出。
常數
NOTIFICATION_PRE_SORT_CHILDREN = 50 🔗
在子節點將要被排序之前通知,以防有事情需要事先處理。
NOTIFICATION_SORT_CHILDREN = 51 🔗
對子節點進行排序時的通知,必須立即服從。
屬性說明
bool accessibility_region = false 🔗
If true, this container is marked as a region for accessibility. Use Control.accessibility_name to give the region a descriptive name. Screen readers can navigate between regions using landmark navigation.
方法說明
PackedInt32Array _get_allowed_size_flags_horizontal() virtual const 🔗
實作此方法以回傳子節點允許的水平 SizeFlags 列表。這在技術上並不會阻止使用任何其他尺寸旗標,如果您的實作需要的話。這僅是限制屬性檢視器面板中提供給使用者的選項。
注意: 沒有尺寸旗標等同於擁有 Control.SIZE_SHRINK_BEGIN。因此,此值始終為隱式允許。
PackedInt32Array _get_allowed_size_flags_vertical() virtual const 🔗
實作以傳回子節點允許的垂直 SizeFlags 清單。這並不會技術上阻止任何其他大小旗標的使用,如果您的實作需要那樣。這僅限制使用者在屬性檢視器面板中可用的選項。
注意: 沒有大小旗標等同於有 Control.SIZE_SHRINK_BEGIN。因此,這個值總是隱含允許的。
void fit_child_in_rect(child: Control, rect: Rect2) 🔗
在給定的矩形中適配子控制項。這主要是用於建立自訂容器類的輔助工具。
void queue_sort() 🔗
將子節點的重排加入佇列。雖然會被自動呼叫,但也可以在需要時手動呼叫。