Theme

Inherits: Resource < Reference < Object

Theme for controls.

Description

A theme for skinning controls. Controls can be skinned individually, but for complex applications, it's more practical to just create a global theme that defines everything. This theme can be applied to any Control; the Control and its children will automatically use it.

Theme resources can alternatively be loaded by writing them in a .theme file, see the documentation for more information.

Properties

Font

default_font

Methods

void

clear ( )

void

clear_color ( String name, String node_type )

void

clear_constant ( String name, String node_type )

void

clear_font ( String name, String node_type )

void

clear_icon ( String name, String node_type )

void

clear_stylebox ( String name, String node_type )

void

clear_theme_item ( DataType data_type, String name, String node_type )

void

copy_default_theme ( )

void

copy_theme ( Theme other )

Color

get_color ( String name, String node_type ) const

PoolStringArray

get_color_list ( String node_type ) const

PoolStringArray

get_color_types ( ) const

int

get_constant ( String name, String node_type ) const

PoolStringArray

get_constant_list ( String node_type ) const

PoolStringArray

get_constant_types ( ) const

Font

get_font ( String name, String node_type ) const

PoolStringArray

get_font_list ( String node_type ) const

PoolStringArray

get_font_types ( ) const

Texture

get_icon ( String name, String node_type ) const

PoolStringArray

get_icon_list ( String node_type ) const

PoolStringArray

get_icon_types ( ) const

StyleBox

get_stylebox ( String name, String node_type ) const

PoolStringArray

get_stylebox_list ( String node_type ) const

PoolStringArray

get_stylebox_types ( ) const

Variant

get_theme_item ( DataType data_type, String name, String node_type ) const

PoolStringArray

get_theme_item_list ( DataType data_type, String node_type ) const

PoolStringArray

get_theme_item_types ( DataType data_type ) const

PoolStringArray

get_type_list ( String node_type ) const

bool

has_color ( String name, String node_type ) const

bool

has_constant ( String name, String node_type ) const

bool

has_default_font ( ) const

bool

has_font ( String name, String node_type ) const

bool

has_icon ( String name, String node_type ) const

bool

has_stylebox ( String name, String node_type ) const

bool

has_theme_item ( DataType data_type, String name, String node_type ) const

void

merge_with ( Theme other )

void

rename_color ( String old_name, String name, String node_type )

void

rename_constant ( String old_name, String name, String node_type )

void

rename_font ( String old_name, String name, String node_type )

void

rename_icon ( String old_name, String name, String node_type )

void

rename_stylebox ( String old_name, String name, String node_type )

void

rename_theme_item ( DataType data_type, String old_name, String name, String node_type )

void

set_color ( String name, String node_type, Color color )

void

set_constant ( String name, String node_type, int constant )

void

set_font ( String name, String node_type, Font font )

void

set_icon ( String name, String node_type, Texture texture )

void

set_stylebox ( String name, String node_type, StyleBox texture )

void

set_theme_item ( DataType data_type, String name, String node_type, Variant value )

Enumerations

enum DataType:

  • DATA_TYPE_COLOR = 0 --- Theme's Color item type.

  • DATA_TYPE_CONSTANT = 1 --- Theme's constant item type.

  • DATA_TYPE_FONT = 2 --- Theme's Font item type.

  • DATA_TYPE_ICON = 3 --- Theme's icon Texture item type.

  • DATA_TYPE_STYLEBOX = 4 --- Theme's StyleBox item type.

  • DATA_TYPE_MAX = 5 --- Maximum value for the DataType enum.

Property Descriptions

Setter

set_default_font(value)

Getter

get_default_font()

The default font of this Theme resource. Used as a fallback value for font items defined in this theme, but having invalid values. If this value is also invalid, the global default value is used.

Use has_default_font to check if this value is valid.

Method Descriptions

  • void clear ( )

Clears all values on the theme.


Clears the Color at name if the theme has node_type.


Clears the constant at name if the theme has node_type.


Clears the Font at name if the theme has node_type.


Clears the icon at name if the theme has node_type.


Clears StyleBox at name if the theme has node_type.


Clears the theme item of data_type at name if the theme has node_type.


  • void copy_default_theme ( )

Sets the theme's values to a copy of the default theme values.


  • void copy_theme ( Theme other )

Sets the theme's values to a copy of a given theme.


Returns the Color at name if the theme has node_type.


Returns all the Colors as a PoolStringArray filled with each Color's name, for use in get_color, if the theme has node_type.


Returns all the Color types as a PoolStringArray filled with unique type names, for use in get_color and/or get_color_list.


Returns the constant at name if the theme has node_type.


Returns all the constants as a PoolStringArray filled with each constant's name, for use in get_constant, if the theme has node_type.


Returns all the constant types as a PoolStringArray filled with unique type names, for use in get_constant and/or get_constant_list.


Returns the Font at name if the theme has node_type.


Returns all the Fonts as a PoolStringArray filled with each Font's name, for use in get_font, if the theme has node_type.


Returns all the Font types as a PoolStringArray filled with unique type names, for use in get_font and/or get_font_list.


Returns the icon Texture at name if the theme has node_type.


Returns all the icons as a PoolStringArray filled with each Texture's name, for use in get_icon, if the theme has node_type.


Returns all the icon types as a PoolStringArray filled with unique type names, for use in get_icon and/or get_icon_list.


Returns the StyleBox at name if the theme has node_type.

Valid names may be found using get_stylebox_list. Valid node_types may be found using get_stylebox_types.


Returns all the StyleBoxs as a PoolStringArray filled with each StyleBox's name, for use in get_stylebox, if the theme has node_type.

Valid node_types may be found using get_stylebox_types.


Returns all the StyleBox types as a PoolStringArray filled with unique type names, for use in get_stylebox and/or get_stylebox_list.


Returns the theme item of data_type at name if the theme has node_type.

Valid names may be found using get_theme_item_list or a data type specific method. Valid node_types may be found using get_theme_item_types or a data type specific method.


Returns all the theme items of data_type as a PoolStringArray filled with each theme items's name, for use in get_theme_item or a data type specific method, if the theme has node_type.

Valid node_types may be found using get_theme_item_types or a data type specific method.


Returns all the theme items of data_type types as a PoolStringArray filled with unique type names, for use in get_theme_item, get_theme_item_list or data type specific methods.


Returns all the theme types as a PoolStringArray filled with unique type names, for use in other get_* functions of this theme.

Note: node_type has no effect and will be removed in future version.


Returns true if Color with name is in node_type.

Returns false if the theme does not have node_type.


Returns true if constant with name is in node_type.

Returns false if the theme does not have node_type.


  • bool has_default_font ( ) const

Returns true if this theme has a valid default_font value.


Returns true if Font with name is in node_type.

Returns false if the theme does not have node_type.


Returns true if icon Texture with name is in node_type.

Returns false if the theme does not have node_type.


Returns true if StyleBox with name is in node_type.

Returns false if the theme does not have node_type.


Returns true if a theme item of data_type with name is in node_type.

Returns false if the theme does not have node_type.


  • void merge_with ( Theme other )

Adds missing and overrides existing definitions with values from the other Theme.

Note: This modifies the current theme. If you want to merge two themes together without modifying either one, create a new empty theme and merge the other two into it one after another.


Renames the Color at old_name to name if the theme has node_type. If name is already taken, this method fails.


Renames the constant at old_name to name if the theme has node_type. If name is already taken, this method fails.


Renames the Font at old_name to name if the theme has node_type. If name is already taken, this method fails.


Renames the icon at old_name to name if the theme has node_type. If name is already taken, this method fails.


Renames StyleBox at old_name to name if the theme has node_type. If name is already taken, this method fails.


Renames the theme item of data_type at old_name to name if the theme has node_type. If name is already taken, this method fails.


Sets the theme's Color to color at name in node_type.

Creates node_type if the theme does not have it.


Sets the theme's constant to constant at name in node_type.

Creates node_type if the theme does not have it.


Sets the theme's Font to font at name in node_type.

Creates node_type if the theme does not have it.


Sets the theme's icon Texture to texture at name in node_type.

Creates node_type if the theme does not have it.


Sets theme's StyleBox to stylebox at name in node_type.

Creates node_type if the theme does not have it.


Sets the theme item of data_type to value at name in node_type.

Does nothing if the value type does not match data_type.

Creates node_type if the theme does not have it.