StyleBoxFlat

Inherits: StyleBox < Resource < Reference < Object

Personalizable StyleBox con un conjunto determinado de parámetros (no requiere textura).

Descripción

This StyleBox can be used to achieve all kinds of looks without the need of a texture. The following properties are customizable:

  • Color

  • Border width (individual width for each border)

  • Rounded corners (individual radius for each corner)

  • Shadow (with blur and offset)

Setting corner radius to high values is allowed. As soon as corners overlap, the stylebox will switch to a relative system. Example:

height = 30
corner_radius_top_left = 50
corner_radius_bottom_left = 100

The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will never be more than the height. Result:

corner_radius_top_left: 10
corner_radius_bottom_left: 20

Propiedades

bool

anti_aliasing

true

float

anti_aliasing_size

0.625

Color

bg_color

Color( 0.6, 0.6, 0.6, 1 )

bool

border_blend

false

Color

border_color

Color( 0.8, 0.8, 0.8, 1 )

int

border_width_bottom

0

int

border_width_left

0

int

border_width_right

0

int

border_width_top

0

int

corner_detail

8

int

corner_radius_bottom_left

0

int

corner_radius_bottom_right

0

int

corner_radius_top_left

0

int

corner_radius_top_right

0

bool

draw_center

true

float

expand_margin_bottom

0.0

float

expand_margin_left

0.0

float

expand_margin_right

0.0

float

expand_margin_top

0.0

Color

shadow_color

Color( 0, 0, 0, 0.6 )

Vector2

shadow_offset

Vector2( 0, 0 )

int

shadow_size

0

Métodos

int

get_border_width ( Margin margin ) const

int

get_border_width_min ( ) const

int

get_corner_radius ( Corner corner ) const

float

get_expand_margin ( Margin margin ) const

void

set_border_width ( Margin margin, int width )

void

set_border_width_all ( int width )

void

set_corner_radius ( Corner corner, int radius )

void

set_corner_radius_all ( int radius )

void

set_corner_radius_individual ( int radius_top_left, int radius_top_right, int radius_bottom_right, int radius_bottom_left )

void

set_expand_margin ( Margin margin, float size )

void

set_expand_margin_all ( float size )

void

set_expand_margin_individual ( float size_left, float size_top, float size_right, float size_bottom )

Descripciones de Propiedades

  • bool anti_aliasing

Default

true

Setter

set_anti_aliased(value)

Getter

is_anti_aliased()

Antialiasing draws a small ring around the edges, which fades to transparency. As a result, edges look much smoother. This is only noticeable when using rounded corners.

Note: When using beveled corners with 45-degree angles (corner_detail = 1), it is recommended to set anti_aliasing to false to ensure crisp visuals and avoid possible visual glitches.


  • float anti_aliasing_size

Default

0.625

Setter

set_aa_size(value)

Getter

get_aa_size()

Esto cambia el tamaño del anillo descolorido. Se pueden usar valores más altos para lograr un efecto "borroso".


Default

Color( 0.6, 0.6, 0.6, 1 )

Setter

set_bg_color(value)

Getter

get_bg_color()

El color de fondo de la caja de estilo.


Default

false

Setter

set_border_blend(value)

Getter

get_border_blend()

Si true, el borde se desvanecerá en el color de fondo.


Default

Color( 0.8, 0.8, 0.8, 1 )

Setter

set_border_color(value)

Getter

get_border_color()

Establece el color del borde.


  • int border_width_bottom

Default

0

Setter

set_border_width(value)

Getter

get_border_width()

Ancho del borde para el borde inferior.


  • int border_width_left

Default

0

Setter

set_border_width(value)

Getter

get_border_width()

Ancho del borde para el borde izquierdo.


  • int border_width_right

Default

0

Setter

set_border_width(value)

Getter

get_border_width()

Ancho del borde para el borde derecho.


  • int border_width_top

Default

0

Setter

set_border_width(value)

Getter

get_border_width()

Ancho del borde para el borde superior.


  • int corner_detail

Default

8

Setter

set_corner_detail(value)

Getter

get_corner_detail()

This sets the number of vertices used for each corner. Higher values result in rounder corners but take more processing power to compute. When choosing a value, you should take the corner radius (set_corner_radius_all) into account.

For corner radii less than 10, 4 or 5 should be enough. For corner radii less than 30, values between 8 and 12 should be enough.

A corner detail of 1 will result in chamfered corners instead of rounded corners, which is useful for some artistic effects.


  • int corner_radius_bottom_left

Default

0

Setter

set_corner_radius(value)

Getter

get_corner_radius()

El radio de la esquina inferior izquierda. Si 0, la esquina no está redondeada.


  • int corner_radius_bottom_right

Default

0

Setter

set_corner_radius(value)

Getter

get_corner_radius()

El radio de la esquina inferior derecha. Si 0, la esquina no está redondeada.


  • int corner_radius_top_left

Default

0

Setter

set_corner_radius(value)

Getter

get_corner_radius()

El radio de la esquina superior izquierda. Si 0, la esquina no está redondeada.


  • int corner_radius_top_right

Default

0

Setter

set_corner_radius(value)

Getter

get_corner_radius()

El radio de la esquina superior derecha. Si 0, la esquina no está redondeada.


Default

true

Setter

set_draw_center(value)

Getter

is_draw_center_enabled()

Cambia el dibujo de la parte interior de la caja de estilo.


  • float expand_margin_bottom

Default

0.0

Setter

set_expand_margin(value)

Getter

get_expand_margin()

Expande la caja de estilo fuera del rectángulo de control en el borde inferior. Es útil en combinación con border_width_bottom para dibujar un borde fuera del rectángulo de control.


  • float expand_margin_left

Default

0.0

Setter

set_expand_margin(value)

Getter

get_expand_margin()

Expande la caja de estilo fuera del rectángulo de control en el borde izquierdo. Es útil en combinación con border_width_left para dibujar un borde fuera del rectángulo de control.


  • float expand_margin_right

Default

0.0

Setter

set_expand_margin(value)

Getter

get_expand_margin()

Expande la caja de estilo fuera del rectángulo de control en el borde derecho. Es útil en combinación con border_width_right para dibujar un borde fuera del rectángulo de control.


  • float expand_margin_top

Default

0.0

Setter

set_expand_margin(value)

Getter

get_expand_margin()

Expande la caja de estilo fuera del rectángulo de control en el borde superior. Es útil en combinación con border_width_top para dibujar un borde fuera del rectángulo de control.


Default

Color( 0, 0, 0, 0.6 )

Setter

set_shadow_color(value)

Getter

get_shadow_color()

El color de la sombra. Esto no tiene efecto si shadow_size es inferior a 1.


Default

Vector2( 0, 0 )

Setter

set_shadow_offset(value)

Getter

get_shadow_offset()

El desplazamiento de la sombra en píxeles. Ajusta la posición de la sombra relativamente al stylebox.


  • int shadow_size

Default

0

Setter

set_shadow_size(value)

Getter

get_shadow_size()

El tamaño de la sombra en píxeles.

Descripciones de Métodos

  • int get_border_width ( Margin margin ) const

Devuelve el ancho del borde del margin dado. Ver Margin para los posibles valores.


  • int get_border_width_min ( ) const

Devuelve el menor ancho de borde de los cuatro bordes.


  • int get_corner_radius ( Corner corner ) const

Devuelve el radio de la corner dado. Ver Corner para los posibles valores.


Devuelve el tamaño de la expansión del margin. Ver Margin para los posibles valores.


  • void set_border_width ( Margin margin, int width )

Establece el ancho del borde a width píxeles para el margin dado. Ver Margin para los posibles valores.


  • void set_border_width_all ( int width )

Establece el ancho del borde a width pixeles para todos los márgenes.


  • void set_corner_radius ( Corner corner, int radius )

Establece el radio de la esquina a radius píxeles para la corner dada. Ver Corner para los posibles valores.


  • void set_corner_radius_all ( int radius )

Establece el radio de la esquina a radius píxeles para todas las esquinas.


  • void set_corner_radius_individual ( int radius_top_left, int radius_top_right, int radius_bottom_right, int radius_bottom_left )

Establece el radio de cada esquina en radius_top_left, radius_top_right, radius_bottom_right, y radius_bottom_left pixeles.


Establece el margen de expansión a size pixels para el margin dado. Ver Margin para los posibles valores.


  • void set_expand_margin_all ( float size )

Establece el margen de expansión a size pixeles para todos los márgenes.


  • void set_expand_margin_individual ( float size_left, float size_top, float size_right, float size_bottom )

Establece el margen de expansión de cada margen en size_left, size_top, size_right, y size_bottom pixeles.