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¶
Methods¶
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¶
Fontdefault_font
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.
PoolStringArrayget_color_list(String node_type)const
Returns all theColors as aPoolStringArray filled with eachColor's name, for use inget_color, if the theme hasnode_type.
PoolStringArrayget_color_types()const
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.
PoolStringArrayget_constant_list(String node_type)const
Returns all the constants as aPoolStringArray filled with each constant's name, for use inget_constant, if the theme hasnode_type.
PoolStringArrayget_constant_types()const
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.
PoolStringArrayget_font_list(String node_type)const
Returns all theFonts as aPoolStringArray filled with eachFont's name, for use inget_font, if the theme hasnode_type.
PoolStringArrayget_font_types()const
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.
PoolStringArrayget_icon_list(String node_type)const
Returns all the icons as aPoolStringArray filled with eachTexture's name, for use inget_icon, if the theme hasnode_type.
PoolStringArrayget_icon_types()const
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.
PoolStringArrayget_stylebox_list(String node_type)const
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.
PoolStringArrayget_stylebox_types()const
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.
PoolStringArrayget_theme_item_list(DataType data_type,String node_type)const
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.
PoolStringArrayget_theme_item_types(DataType data_type)const
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.
PoolStringArrayget_type_list(String node_type)const
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.
voidmerge_with(Theme other)
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.