Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

StyleBox

Inherits: Resource < RefCounted < Object

Inherited By: StyleBoxEmpty, StyleBoxFlat, StyleBoxLine, StyleBoxTexture

Abstract base class for defining stylized boxes for UI elements.

Description

StyleBox is an abstract base class for drawing stylized boxes for UI elements. It is used for panels, buttons, LineEdit 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 control nodes 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.

Properties

float

content_margin_bottom

-1.0

float

content_margin_left

-1.0

float

content_margin_right

-1.0

float

content_margin_top

-1.0

Methods

void

_draw ( RID to_canvas_item, Rect2 rect ) virtual const

Rect2

_get_draw_rect ( Rect2 rect ) virtual const

Vector2

_get_minimum_size ( ) virtual const

bool

_test_mask ( Vector2 point,