mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
Currently including `zh_CN` and `es` which both have very high completion ratios. Others will be added once they reach a significant percentage too. These RST files will be used by godot-docs in place of its `classes` folder after we sync with https://github.com/godotengine/godot-docs/pull/5458. The update workflow is manual for now (example for `zh_CN`): - Build `godotengine/godot` in the branch we currently track (now `3.x`) - Run `godot --doctool -l zh_CN` - Run `cd doc && make rst LANGARG=zh_CN` - Copy `doc/_build/rst/*` to `classes/zh_CN/` here - Make sure to have `classes/zh_CN/index.rst` copied from `docs/classes`
218 lines
12 KiB
ReStructuredText
218 lines
12 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the StyleBox.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_StyleBox:
|
|
|
|
StyleBox
|
|
========
|
|
|
|
**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
|
|
|
|
**Inherited By:** :ref:`StyleBoxEmpty<class_StyleBoxEmpty>`, :ref:`StyleBoxFlat<class_StyleBoxFlat>`, :ref:`StyleBoxLine<class_StyleBoxLine>`, :ref:`StyleBoxTexture<class_StyleBoxTexture>`
|
|
|
|
Clase base para dibujar cajas estilizadas para la UI.
|
|
|
|
Descripción
|
|
----------------------
|
|
|
|
StyleBox is :ref:`Resource<class_Resource>` that provides an abstract base class for drawing stylized boxes for the UI. StyleBoxes are used for drawing the styles of buttons, line edit backgrounds, tree backgrounds, etc. and also for testing a transparency mask for pointer signals. If mask test fails on a StyleBox assigned as mask to a control, clicks and motion signals will go through it to the one below.
|
|
|
|
\ **Note:** For children of :ref:`Control<class_Control>` that have *Theme Properties*, the ``focus`` ``StyleBox`` is displayed over the ``normal``, ``hover`` or ``pressed`` ``StyleBox``. This makes the ``focus`` ``StyleBox`` more reusable across different nodes.
|
|
|
|
Propiedades
|
|
----------------------
|
|
|
|
+---------------------------+-----------------------------------------------------------------------------+----------+
|
|
| :ref:`float<class_float>` | :ref:`content_margin_bottom<class_StyleBox_property_content_margin_bottom>` | ``-1.0`` |
|
|
+---------------------------+-----------------------------------------------------------------------------+----------+
|
|
| :ref:`float<class_float>` | :ref:`content_margin_left<class_StyleBox_property_content_margin_left>` | ``-1.0`` |
|
|
+---------------------------+-----------------------------------------------------------------------------+----------+
|
|
| :ref:`float<class_float>` | :ref:`content_margin_right<class_StyleBox_property_content_margin_right>` | ``-1.0`` |
|
|
+---------------------------+-----------------------------------------------------------------------------+----------+
|
|
| :ref:`float<class_float>` | :ref:`content_margin_top<class_StyleBox_property_content_margin_top>` | ``-1.0`` |
|
|
+---------------------------+-----------------------------------------------------------------------------+----------+
|
|
|
|
Métodos
|
|
--------------
|
|
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`draw<class_StyleBox_method_draw>` **(** :ref:`RID<class_RID>` canvas_item, :ref:`Rect2<class_Rect2>` rect **)** |const| |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_center_size<class_StyleBox_method_get_center_size>` **(** **)** |const| |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`CanvasItem<class_CanvasItem>` | :ref:`get_current_item_drawn<class_StyleBox_method_get_current_item_drawn>` **(** **)** |const| |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_default_margin<class_StyleBox_method_get_default_margin>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const| |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_margin<class_StyleBox_method_get_margin>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const| |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_minimum_size<class_StyleBox_method_get_minimum_size>` **(** **)** |const| |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_offset<class_StyleBox_method_get_offset>` **(** **)** |const| |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_default_margin<class_StyleBox_method_set_default_margin>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` offset **)** |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`test_mask<class_StyleBox_method_test_mask>` **(** :ref:`Vector2<class_Vector2>` point, :ref:`Rect2<class_Rect2>` rect **)** |const| |
|
|
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Descripciones de Propiedades
|
|
--------------------------------------------------------
|
|
|
|
.. _class_StyleBox_property_content_margin_bottom:
|
|
|
|
- :ref:`float<class_float>` **content_margin_bottom**
|
|
|
|
+-----------+---------------------------+
|
|
| *Default* | ``-1.0`` |
|
|
+-----------+---------------------------+
|
|
| *Setter* | set_default_margin(value) |
|
|
+-----------+---------------------------+
|
|
| *Getter* | get_default_margin() |
|
|
+-----------+---------------------------+
|
|
|
|
El margen inferior para el contenido de esta caja de estilo. Aumentando este valor se reduce el espacio disponible para los contenidos desde la parte inferior.
|
|
|
|
Si este valor es negativo, se ignora y en su lugar se utiliza un margen específico para el niño. Por ejemplo, para :ref:`StyleBoxFlat<class_StyleBoxFlat>` se utiliza en su lugar el grosor del borde (si lo hay).
|
|
|
|
Depende del código que utilice este cuadro de estilo decidir cuáles son estos contenidos: por ejemplo, un :ref:`Button<class_Button>` respeta este margen de contenido para el contenido textual del botón.
|
|
|
|
El :ref:`get_margin<class_StyleBox_method_get_margin>` debe ser usado para obtener este valor como consumidor en lugar de leer estas propiedades directamente. Esto se debe a que respeta correctamente los valores negativos y la solución alternativa mencionada anteriormente.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_property_content_margin_left:
|
|
|
|
- :ref:`float<class_float>` **content_margin_left**
|
|
|
|
+-----------+---------------------------+
|
|
| *Default* | ``-1.0`` |
|
|
+-----------+---------------------------+
|
|
| *Setter* | set_default_margin(value) |
|
|
+-----------+---------------------------+
|
|
| *Getter* | get_default_margin() |
|
|
+-----------+---------------------------+
|
|
|
|
The left margin for the contents of this style box. Increasing this value reduces the space available to the contents from the left.
|
|
|
|
Refer to :ref:`content_margin_bottom<class_StyleBox_property_content_margin_bottom>` for extra considerations.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_property_content_margin_right:
|
|
|
|
- :ref:`float<class_float>` **content_margin_right**
|
|
|
|
+-----------+---------------------------+
|
|
| *Default* | ``-1.0`` |
|
|
+-----------+---------------------------+
|
|
| *Setter* | set_default_margin(value) |
|
|
+-----------+---------------------------+
|
|
| *Getter* | get_default_margin() |
|
|
+-----------+---------------------------+
|
|
|
|
El margen derecho para el contenido de esta caja de estilo. Aumentando este valor se reduce el espacio disponible para los contenidos de la derecha.
|
|
|
|
Consulte :ref:`content_margin_bottom<class_StyleBox_property_content_margin_bottom>` para consideraciones adicionales.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_property_content_margin_top:
|
|
|
|
- :ref:`float<class_float>` **content_margin_top**
|
|
|
|
+-----------+---------------------------+
|
|
| *Default* | ``-1.0`` |
|
|
+-----------+---------------------------+
|
|
| *Setter* | set_default_margin(value) |
|
|
+-----------+---------------------------+
|
|
| *Getter* | get_default_margin() |
|
|
+-----------+---------------------------+
|
|
|
|
El margen superior para el contenido de esta caja de estilo. Aumentando este valor se reduce el espacio disponible para los contenidos desde la parte superior.
|
|
|
|
Consulte :ref:`content_margin_bottom<class_StyleBox_property_content_margin_bottom>` para consideraciones adicionales.
|
|
|
|
Descripciones de Métodos
|
|
------------------------------------------------
|
|
|
|
.. _class_StyleBox_method_draw:
|
|
|
|
- void **draw** **(** :ref:`RID<class_RID>` canvas_item, :ref:`Rect2<class_Rect2>` rect **)** |const|
|
|
|
|
Dibuja este cuadro de estilo usando un :ref:`CanvasItem<class_CanvasItem>` con un :ref:`RID<class_RID>` dado.
|
|
|
|
Puedes obtener un valor :ref:`RID<class_RID>` usando el :ref:`Object.get_instance_id<class_Object_method_get_instance_id>` en un nodo derivado de :ref:`CanvasItem<class_CanvasItem>`.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_method_get_center_size:
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_center_size** **(** **)** |const|
|
|
|
|
Devuelve el tamaño de este ``StyleBox`` sin los márgenes.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_method_get_current_item_drawn:
|
|
|
|
- :ref:`CanvasItem<class_CanvasItem>` **get_current_item_drawn** **(** **)** |const|
|
|
|
|
Devuelve el :ref:`CanvasItem<class_CanvasItem>` que maneja su :ref:`CanvasItem.NOTIFICATION_DRAW<class_CanvasItem_constant_NOTIFICATION_DRAW>` o :ref:`CanvasItem._draw<class_CanvasItem_method__draw>` llamada en este momento.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_method_get_default_margin:
|
|
|
|
- :ref:`float<class_float>` **get_default_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
|
|
|
|
Devuelve el valor por defecto del especificado :ref:`Margin<enum_@GlobalScope_Margin>`.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_method_get_margin:
|
|
|
|
- :ref:`float<class_float>` **get_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
|
|
|
|
Devuelve el desplazamiento del margen de contenido para el especificado :ref:`Margin<enum_@GlobalScope_Margin>`.
|
|
|
|
Los valores positivos reducen el tamaño hacia adentro, a diferencia de los valores de margen de :ref:`Control<class_Control>`.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_method_get_minimum_size:
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_minimum_size** **(** **)** |const|
|
|
|
|
Devuelve el tamaño mínimo al que se puede reducir esta caja de estilo.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_method_get_offset:
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_offset** **(** **)** |const|
|
|
|
|
Devuelve el "desplazamiento" de una caja de estilo. Esta función de ayuda devuelve un valor equivalente a ``Vector2(style.get_margin(MARGIN_LEFT), style.get_margin(MARGIN_TOP))``.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_method_set_default_margin:
|
|
|
|
- void **set_default_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` offset **)**
|
|
|
|
Establece el valor por defecto del :ref:`Margin<enum_@GlobalScope_Margin>` especificado a un ``desplazamiento`` dado en píxeles.
|
|
|
|
----
|
|
|
|
.. _class_StyleBox_method_test_mask:
|
|
|
|
- :ref:`bool<class_bool>` **test_mask** **(** :ref:`Vector2<class_Vector2>` point, :ref:`Rect2<class_Rect2>` rect **)** |const|
|
|
|
|
Pruebe una posición en un rectángulo, vuelva si pasa la prueba de la máscara.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|