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 anyControl; 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.

Tutorials

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

enumDataType:

  • DATA_TYPE_COLOR =0 --- Theme'sColor item type.

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

  • DATA_TYPE_FONT =2 --- Theme'sFont item type.

  • DATA_TYPE_ICON =3 --- Theme's iconTexture item type.

  • DATA_TYPE_STYLEBOX =4 --- Theme'sStyleBox 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 thisTheme 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.

Usehas_default_font to check if this value is valid.

Method Descriptions

  • voidclear()

Clears all values on the theme.


Clears theColor atname if the theme hasnode_type.


Clears the constant atname if the theme hasnode_type.


Clears theFont atname if the theme hasnode_type.


Clears the icon atname if the theme hasnode_type.


ClearsStyleBox atname if the theme hasnode_type.


Clears the theme item ofdata_type atname if the theme hasnode_type.


  • voidcopy_default_theme()

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


  • voidcopy_theme(Theme other)

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


Returns theColor atname if the theme hasnode_type.


Returns all theColors as aPoolStringArray filled with eachColor's name, for use inget_color, if the theme hasnode_type.


Returns all theColor types as aPoolStringArray filled with unique type names, for use inget_color and/orget_color_list.


Returns the constant atname if the theme hasnode_type.


Returns all the constants as aPoolStringArray filled with each constant's name, for use inget_constant, if the theme hasnode_type.


Returns all the constant types as aPoolStringArray filled with unique type names, for use inget_constant and/orget_constant_list.


Returns theFont atname if the theme hasnode_type.


Returns all theFonts as aPoolStringArray filled with eachFont's name, for use inget_font, if the theme hasnode_type.


Returns all theFont types as aPoolStringArray filled with unique type names, for use inget_font and/orget_font_list.


Returns the iconTexture atname if the theme hasnode_type.


Returns all the icons as aPoolStringArray filled with eachTexture's name, for use inget_icon, if the theme hasnode_type.


Returns all the icon types as aPoolStringArray filled with unique type names, for use inget_icon and/orget_icon_list.


Returns theStyleBox atname if the theme hasnode_type.

Validnames may be found usingget_stylebox_list. Validnode_types may be found usingget_stylebox_types.


Returns all theStyleBoxs as aPoolStringArray filled with eachStyleBox's name, for use inget_stylebox, if the theme hasnode_type.

Validnode_types may be found usingget_stylebox_types.


Returns all theStyleBox types as aPoolStringArray filled with unique type names, for use inget_stylebox and/orget_stylebox_list.


Returns the theme item ofdata_type atname if the theme hasnode_type.

Validnames may be found usingget_theme_item_list or a data type specific method. Validnode_types may be found usingget_theme_item_types or a data type specific method.


Returns all the theme items ofdata_type as aPoolStringArray filled with each theme items's name, for use inget_theme_item or a data type specific method, if the theme hasnode_type.

Validnode_types may be found usingget_theme_item_types or a data type specific method.


Returns all the theme items ofdata_type types as aPoolStringArray filled with unique type names, for use inget_theme_item,get_theme_item_list or data type specific methods.


Returns all the theme types as aPoolStringArray filled with unique type names, for use in otherget_* functions of this theme.

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


Returnstrue ifColor withname is innode_type.

Returnsfalse if the theme does not havenode_type.


Returnstrue if constant withname is innode_type.

Returnsfalse if the theme does not havenode_type.


Returnstrue if this theme has a validdefault_font value.


Returnstrue ifFont withname is innode_type.

Returnsfalse if the theme does not havenode_type.


Returnstrue if iconTexture withname is innode_type.

Returnsfalse if the theme does not havenode_type.


Returnstrue ifStyleBox withname is innode_type.

Returnsfalse if the theme does not havenode_type.


Returnstrue if a theme item ofdata_type withname is innode_type.

Returnsfalse if the theme does not havenode_type.


Adds missing and overrides existing definitions with values from theotherTheme.

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 theColor atold_name toname if the theme hasnode_type. Ifname is already taken, this method fails.


Renames the constant atold_name toname if the theme hasnode_type. Ifname is already taken, this method fails.


Renames theFont atold_name toname if the theme hasnode_type. Ifname is already taken, this method fails.


Renames the icon atold_name toname if the theme hasnode_type. Ifname is already taken, this method fails.


RenamesStyleBox atold_name toname if the theme hasnode_type. Ifname is already taken, this method fails.


Renames the theme item ofdata_type atold_name toname if the theme hasnode_type. Ifname is already taken, this method fails.


Sets the theme'sColor tocolor atname innode_type.

Createsnode_type if the theme does not have it.


Sets the theme's constant toconstant atname innode_type.

Createsnode_type if the theme does not have it.


Sets the theme'sFont tofont atname innode_type.

Createsnode_type if the theme does not have it.


Sets the theme's iconTexture totexture atname innode_type.

Createsnode_type if the theme does not have it.


Sets theme'sStyleBox tostylebox atname innode_type.

Createsnode_type if the theme does not have it.


Sets the theme item ofdata_type tovalue atname innode_type.

Does nothing if thevalue type does not matchdata_type.

Createsnode_type if the theme does not have it.