SplitContainer

Наследует: Container < Control < CanvasItem < Node < Object

Наследуется от: HSplitContainer, VSplitContainer

A container that arranges child controls horizontally or vertically and provides grabbers for adjusting the split ratios between them.

Описание

A container that arranges child controls horizontally or vertically and creates grabbers between them. The grabbers can be dragged around to change the size relations between the child controls.

Обучающие материалы

Свойства

bool

collapsed

false

bool

drag_area_highlight_in_editor

false

int

drag_area_margin_begin

0

int

drag_area_margin_end

0

int

drag_area_offset

0

DraggerVisibility

dragger_visibility

0

bool

dragging_enabled

true

int

split_offset

0

PackedInt32Array

split_offsets

PackedInt32Array(0)

bool

touch_dragger_enabled

false

bool

vertical

false

Методы

void

clamp_split_offset(priority_index: int = 0)

Control

get_drag_area_control()

Array[Control]

get_drag_area_controls()

Свойства темы

Color

touch_dragger_color

Color(1, 1, 1, 0.3)

Color

touch_dragger_hover_color

Color(1, 1, 1, 0.6)

Color

touch_dragger_pressed_color

Color(1, 1, 1, 1)

int

autohide

1

int

minimum_grab_thickness

6

int

separation

12

Texture2D

grabber

Texture2D

h_grabber

Texture2D

h_touch_dragger

Texture2D

touch_dragger

Texture2D

v_grabber

Texture2D

v_touch_dragger

StyleBox

split_bar_background


Сигналы

drag_ended() 🔗

Генерируется, когда пользователь заканчивает перетаскивание.


drag_started() 🔗

Генерируется, когда пользователь начинает перетаскивание.


dragged(offset: int) 🔗

Emitted when any dragger is dragged by user.


Перечисления

enum DraggerVisibility: 🔗

DraggerVisibility DRAGGER_VISIBLE = 0

Значок раздельного перетаскивателя всегда виден, когда autohide равно false, в противном случае виден только при наведении курсора на него.

Размер значка захвата определяет минимальное separation.

Значок перетаскивателя автоматически скрывается, если длина значка захвата больше, чем разделительная полоса.

DraggerVisibility DRAGGER_HIDDEN = 1

Значок раздельного перетаскивателя никогда не отображается независимо от значения autohide.

Размер значка перетаскивателя определяет минимальное separation.

DraggerVisibility DRAGGER_HIDDEN_COLLAPSED = 2

Значок перетаскивателя для разделения не отображается, а полоса разделения свернута до нулевой толщины.


Описания свойств

bool collapsed = false 🔗

  • void set_collapsed(value: bool)

  • bool is_collapsed()

If true, the draggers will be disabled and the children will be sized as if all split_offsets were 0.


bool drag_area_highlight_in_editor = false 🔗

  • void set_drag_area_highlight_in_editor(value: bool)

  • bool is_drag_area_highlight_in_editor_enabled()

Выделяет область перетаскивания Rect2, чтобы вы могли видеть, где она находится во время разработки. Область перетаскивания золотая, если dragging_enabled равно true, и красная, если false.


int drag_area_margin_begin = 0 🔗

  • void set_drag_area_margin_begin(value: int)

  • int get_drag_area_margin_begin()

Уменьшает размер области перетаскивания и разделительной полосы split_bar_background в начале контейнера.


int drag_area_margin_end = 0 🔗

  • void set_drag_area_margin_end(value: int)

  • int get_drag_area_margin_end()

Уменьшает размер области перетаскивания и разделительной полосы split_bar_background в конце контейнера.


int drag_area_offset = 0 🔗

  • void set_drag_area_offset(value: int)

  • int get_drag_area_offset()

Смещает область перетаскивания по оси контейнера, чтобы предотвратить перекрытие области перетаскивания ScrollBar или другого выбираемого Control дочернего узла.


DraggerVisibility dragger_visibility = 0 🔗

Определяет видимость перетаскивателя. Это свойство не определяет, включено ли перетаскивание или нет. Для этого используйте dragging_enabled.


bool dragging_enabled = true 🔗

  • void set_dragging_enabled(value: bool)

  • bool is_dragging_enabled()

Включает или отключает раздельное перетаскивание.


int split_offset = 0 🔗

  • void set_split_offset(value: int)

  • int get_split_offset()

Устарело: Use split_offsets instead. The first element of the array is the split offset between the first two children.

The first element of split_offsets.


PackedInt32Array split_offsets = PackedInt32Array(0) 🔗

Offsets for each dragger in pixels. Each one is the offset of the split between the Control nodes before and after the dragger, with 0 being the default position. The default position is based on the Control nodes expand flags and minimum sizes. See Control.size_flags_horizontal, Control.size_flags_vertical, and Control.size_flags_stretch_ratio.

If none of the Control nodes before the dragger are expanded, the default position will be at the start of the SplitContainer. If none of the Control nodes after the dragger are expanded, the default position will be at the end of the SplitContainer. If the dragger is in between expanded Control nodes, the default position will be in the middle, based on the Control.size_flags_stretch_ratios and minimum sizes.

Note: If the split offsets cause Control nodes to overlap, the first split will take priority when resolving the positions.

Note: The returned array is copied and any changes to it will not update the original property value. See PackedInt32Array for more details.


bool touch_dragger_enabled = false 🔗

  • void set_touch_dragger_enabled(value: bool)

  • bool is_touch_dragger_enabled()

Если true, сенсорный манипулятор перетаскивания будет включен для лучшего использования на экранах меньшего размера. В отличие от стандартного захвата, этот манипулятор перекрывает дочерние элементы SplitContainer и не влияет на их минимальное разделение. Стандартный захват больше не будет отображаться, если эта опция включена.


bool vertical = false 🔗

  • void set_vertical(value: bool)

  • bool is_vertical()

Если true, SplitContainer расположит свои дочерние элементы вертикально, а не горизонтально.

Нельзя изменить при использовании HSplitContainer и VSplitContainer.


Описания метода

void clamp_split_offset(priority_index: int = 0) 🔗

Clamps the split_offsets values to ensure they are within valid ranges and do not overlap with each other. When overlaps occur, this method prioritizes one split offset (at index priority_index) by clamping any overlapping split offsets to it.


Control get_drag_area_control() 🔗

Устарело: Use the first element of get_drag_area_controls() instead.

Возвращает область перетаскивания Control. Например, вы можете переместить предварительно настроенную кнопку в область перетаскивания Control, чтобы она перемещалась вместе с разделительной полосой. Попробуйте установить якоря Button на center до вызова reparent().

$BarnacleButton.reparent($SplitContainer.get_drag_area_control())

Примечание: Область перетаскивания Control рисуется поверх дочерних элементов SplitContainer, поэтому объекты рисования CanvasItem, вызываемые из Control, и дочерние элементы, добавленные в Control, также будут отображаться поверх дочерних элементов SplitContainer. Попробуйте установить Control.mouse_filter пользовательских дочерних элементов на Control.MOUSE_FILTER_IGNORE, чтобы предотвратить блокировку мыши при перетаскивании, если это необходимо.

Предупреждение: Это обязательный внутренний узел, его удаление и освобождение может привести к сбою.


Array[Control] get_drag_area_controls() 🔗

Returns an Array of the drag area Controls. These are the interactable Control nodes between each child. For example, this can be used to add a pre-configured button to a drag area Control so that it rides along with the split bar. Try setting the Button anchors to center prior to the Node.reparent() call.

$BarnacleButton.reparent($SplitContainer.get_drag_area_controls()[0])

Note: The drag area Controls are drawn over the SplitContainer's children, so CanvasItem draw objects called from a drag area and children added to it will also appear over the SplitContainer's children. Try setting Control.mouse_filter of custom children to Control.MOUSE_FILTER_IGNORE to prevent blocking the mouse from dragging if desired.

Warning: These are required internal nodes, removing or freeing them may cause a crash.


Описания свойств темы

Color touch_dragger_color = Color(1, 1, 1, 0.3) 🔗

Цвет сенсорного перетаскивателя.


Color touch_dragger_hover_color = Color(1, 1, 1, 0.6) 🔗

Цвет сенсорного ползунка при наведении курсора.


Color touch_dragger_pressed_color = Color(1, 1, 1, 1) 🔗

Цвет сенсорного ползунка при нажатии.


int autohide = 1 🔗

Boolean value. If 1 (true), the grabbers will hide automatically when they aren't under the cursor. If 0 (false), the grabbers are always visible. The dragger_visibility must be DRAGGER_VISIBLE.


int minimum_grab_thickness = 6 🔗

The minimum thickness of the area users can click on to grab a split bar. This ensures that the split bar can still be dragged if separation or h_grabber / v_grabber's size is too narrow to easily select.


int separation = 12 🔗

The split bar thickness, i.e., the gap between each child of the container. This is overridden by the size of the grabber icon if dragger_visibility is set to DRAGGER_VISIBLE, or DRAGGER_HIDDEN, and separation is smaller than the size of the grabber icon in the same axis.

Note: To obtain separation values less than the size of the grabber icon, for example a 1 px hairline, set h_grabber or v_grabber to a new ImageTexture, which effectively sets the grabber icon size to 0 px.


Texture2D grabber 🔗

The icon used for the grabbers drawn in the separations. This is only used in HSplitContainer and VSplitContainer. For SplitContainer, see h_grabber and v_grabber instead.


Texture2D h_grabber 🔗

The icon used for the grabbers drawn in the separations when vertical is false.


Texture2D h_touch_dragger 🔗

Значок, используемый для маркера перетаскивания, когда touch_dragger_enabled имеет значение true, а vertical имеет значение false.


Texture2D touch_dragger 🔗

Значок, используемый для ручки перетаскивания, когда touch_dragger_enabled равен true. Используется только в HSplitContainer и VSplitContainer. Для SplitContainer см. h_touch_dragger и v_touch_dragger.


Texture2D v_grabber 🔗

The icon used for the grabbers drawn in the separations when vertical is true.


Texture2D v_touch_dragger 🔗

Значок, используемый для маркера перетаскивания, когда touch_dragger_enabled имеет значение true и vertical имеет значение true.


StyleBox split_bar_background 🔗

Определяет фон разделенной полосы, если ее толщина больше нуля.