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.

SplitContainer

Eredita: Container < Control < CanvasItem < Node < Object

Ereditato da: HSplitContainer, VSplitContainer

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

Descrizione

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.

Tutorial

Proprietà

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

bool

drag_nested_intersections

false

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

Metodi

void

clamp_split_offset(priority_index: int = 0)

Control

get_drag_area_control()

Array[Control]

get_drag_area_controls()

Proprietà del tema

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


Segnali

drag_ended() 🔗

Emesso quando l'utente finisce di trascinare.


drag_started() 🔗

Emesso quando l'utente inizia a trascinare.


dragged(offset: int) 🔗

Emitted when any dragger is dragged by user.


Enumerazioni

enum DraggerVisibility: 🔗

DraggerVisibility DRAGGER_VISIBLE = 0

L'icona del trascinatore divisore è sempre visibile quando autohide è false, altrimenti visibile solo quando il cursore ci passa sopra.

Le dimensioni dell'icona del grabber determinano la separazione minima (separation).

L'icona del trascinatore viene nascosta automaticamente se la lunghezza dell'icona del grabber è maggiore della barra di divisione.

DraggerVisibility DRAGGER_HIDDEN = 1

L'icona del trascinatore divisore non è mai visibile, a prescindere dal valore di autohide.

Le dimensioni dell'icona del grabber determinano la separazione minima (separation).

DraggerVisibility DRAGGER_HIDDEN_COLLAPSED = 2

L'icona del trascinatore divisore non è visibile, e la barra di divisione è ridotta a spessore zero.


Descrizioni delle proprietà

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()

Evidenzia il Rect2 dell'area di trascinamento in modo da poter vedere dove si trova durante lo sviluppo. L'area di trascinamento è dorata se dragging_enabled è true, e rossa se false.


int drag_area_margin_begin = 0 🔗

  • void set_drag_area_margin_begin(value: int)

  • int get_drag_area_margin_begin()

Riduce le dimensioni dell'area di trascinamento e di split_bar_background della barra di divisione all'inizio del contenitore.


int drag_area_margin_end = 0 🔗

  • void set_drag_area_margin_end(value: int)

  • int get_drag_area_margin_end()

Riduce le dimensioni dell'area di trascinamento e di split_bar_background della barra di divisione alla fine del contenitore.


int drag_area_offset = 0 🔗

  • void set_drag_area_offset(value: int)

  • int get_drag_area_offset()

Sposta l'area di trascinamento sull'asse del contenitore per evitare che si sovrapponga alla ScrollBar o ad altri Control selezionabili di un nodo figlio.


bool drag_nested_intersections = false 🔗

  • void set_drag_nested_intersections(value: bool)

  • bool is_dragging_nested_intersections()

Adds extra draggers at the intersection of the draggers of two SplitContainers to allow dragging both at once. This must be set to true for both SplitContainers, and one needs to be a descendant of the other. They also must be orthogonal (their vertical are different) and the descendant must be next to at least one of the ancestor's draggers (within minimum_grab_thickness).


DraggerVisibility dragger_visibility = 0 🔗

Determina la visibilità del trascinatore. Questa proprietà non determina se il trascinamento è abilitato o meno. Utilizzare dragging_enabled a questo scopo.


bool dragging_enabled = true 🔗

  • void set_dragging_enabled(value: bool)

  • bool is_dragging_enabled()

Abilita o disabilita il trascinamento diviso.


int split_offset = 0 🔗

  • void set_split_offset(value: int)

  • int get_split_offset()

Deprecato: 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()

Se true, sarà abilitato un trascinatore ottimizzato per il tocco per migliorare l'usabilità su schermi più piccoli. A differenza del grabber standard, questo trascinatore si sovrappone agli elementi figlio del SplitContainer e non influisce sulla loro separazione minima. Il grabber standard non sarà più visualizzato quando questa opzione è abilitata.


bool vertical = false 🔗

  • void set_vertical(value: bool)

  • bool is_vertical()

Se true, lo SplitContainer organizzerà i suoi elementi figlio verticalmente, anziché orizzontalmente.

Non può essere modificato quando si utilizzano HSplitContainer e VSplitContainer.


Descrizioni dei metodi

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() 🔗

Deprecato: Use the first element of get_drag_area_controls() instead.

Restituisce l'area di trascinamento Control. Ad esempio, è possibile spostare un pulsante preconfigurato nell'area di trascinamento Control in modo che scorra insieme alla barra di divisione. Provare a impostare gli ancoraggi del Button su center prima della chiamata reparent().

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

Nota: L'area di trascinamento Control viene disegnata sui figli di SplitContainer, quindi anche gli oggetti di disegno CanvasItem chiamati da Control e i figli aggiunti a Control appariranno sui figli di SplitContainer. Provare a impostare Control.mouse_filter dei figli personalizzati su Control.MOUSE_FILTER_IGNORE per evitare di bloccare il trascinamento del mouse, se è desiderato.

Attenzione: Questo è un nodo interno obbligatorio, rimuoverlo e liberarlo potrebbe causare un arresto anomalo.


Array[Control] get_drag_area_controls() 🔗

Restituisce un Array dei Control area di trascinamento. Questi sono i nodi Control interattivi tra ciascun elemento figlio. Ad esempio, è possibile spostare un pulsante preconfigurato in un Control area di trascinamento in modo che scorra insieme alla barra di divisione. Prova a impostare gli ancoraggi del Button su center prima di chiamare Node.reparent().

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

Nota: I Control area di trascinamento sono disegnati sopra i figli di SplitContainer, quindi anche gli oggetti di disegno CanvasItem chiamati da un'area di trascinamento e i figli aggiunti appariranno sui figli di SplitContainer. Provare a impostare Control.mouse_filter dei figli personalizzati su Control.MOUSE_FILTER_IGNORE per evitare di bloccare il trascinamento del mouse, se è desiderato.

Attenzione: Questi sono nodi interni obbligatori, rimuoverli o liberarli potrebbe causare un arresto anomalo.


Descrizioni delle proprietà del tema

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

Il colore del trascinatore di tocco.


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

Il colore del trascinatore di tocco al passaggio del mouse.


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

Il colore del trascinatore di tocco quando premuto.


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 🔗

L'icona utilizzata per il trascinatore quando touch_dragger_enabled è true e vertical è false.


Texture2D touch_dragger 🔗

L'icona utilizzata per il trascinatore quando touch_dragger_enabled è true. Questa è utilizzata solo in HSplitContainer e VSplitContainer. Per SplitContainer, vedi invece h_touch_dragger e v_touch_dragger.


Texture2D v_grabber 🔗

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


Texture2D v_touch_dragger 🔗

L'icona utilizzata per trascinatore quando touch_dragger_enabled è true e vertical è true.


StyleBox split_bar_background 🔗

Determina lo sfondo della barra di divisione se il suo spessore è maggiore di zero.