diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-29 14:02:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 14:02:21 +0200 |
commit | e60086f98b07365d6174677df84c9a22bfb56d15 (patch) | |
tree | b1ff19a2fda6a735d883340a389d85e03c6febf5 /doc/classes | |
parent | 0024ba8daddbc7d49458d438ccf578242d900e57 (diff) | |
parent | 6320a0fc18fa84363494df9013b65011a3018a62 (diff) |
Merge pull request #64119 from YuriSizov/theme-init-database
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/@GlobalScope.xml | 3 | ||||
-rw-r--r-- | doc/classes/Control.xml | 2 | ||||
-rw-r--r-- | doc/classes/Theme.xml | 16 | ||||
-rw-r--r-- | doc/classes/ThemeDB.xml | 54 |
4 files changed, 66 insertions, 9 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index e33d0a28fb..71b0901b3d 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1323,6 +1323,9 @@ <member name="TextServerManager" type="TextServerManager" setter="" getter=""> The [TextServerManager] singleton. </member> + <member name="ThemeDB" type="ThemeDB" setter="" getter=""> + The [ThemeDB] singleton. + </member> <member name="Time" type="Time" setter="" getter=""> The [Time] singleton. </member> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 330879390b..0e71dbd0b1 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -436,7 +436,7 @@ <param index="1" name="theme_type" type="StringName" default="""" /> <description> Returns a [Color] from the first matching [Theme] in the tree if that [Theme] has a color item with the specified [param name] and [param theme_type]. If [param theme_type] is omitted the class name of the current control is used as the type, or [member theme_type_variation] if it is defined. If the type is a class name its parent classes are also checked, in order of inheritance. If the type is a variation its base types are checked, in order of dependency, then the control's class name and its parent classes are checked. - For the current control its local overrides are considered first (see [method add_theme_color_override]), then its assigned [member theme]. After the current control, each parent control and its assigned [member theme] are considered; controls without a [member theme] assigned are skipped. If no matching [Theme] is found in the tree, a custom project [Theme] (see [member ProjectSettings.gui/theme/custom]) and the default [Theme] are used. + For the current control its local overrides are considered first (see [method add_theme_color_override]), then its assigned [member theme]. After the current control, each parent control and its assigned [member theme] are considered; controls without a [member theme] assigned are skipped. If no matching [Theme] is found in the tree, the custom project [Theme] (see [member ProjectSettings.gui/theme/custom]) and the default [Theme] are used (see [ThemeDB]). [codeblocks] [gdscript] func _ready(): diff --git a/doc/classes/Theme.xml b/doc/classes/Theme.xml index 868933bdf7..7fc01ea353 100644 --- a/doc/classes/Theme.xml +++ b/doc/classes/Theme.xml @@ -150,7 +150,7 @@ <description> Returns the [Font] property defined by [param name] and [param theme_type], if it exists. Returns the default theme font if the property doesn't exist and the default theme font is set up (see [member default_font]). Use [method has_font] to check for existence of the property and [method has_default_font] to check for existence of the default theme font. - Returns the engine fallback font value, if neither exist. + Returns the engine fallback font value, if neither exist (see [member ThemeDB.fallback_font]). </description> </method> <method name="get_font_list" qualifiers="const"> @@ -167,7 +167,7 @@ <description> Returns the font size property defined by [param name] and [param theme_type], if it exists. Returns the default theme font size if the property doesn't exist and the default theme font size is set up (see [member default_font_size]). Use [method has_font_size] to check for existence of the property and [method has_default_font_size] to check for existence of the default theme font. - Returns the engine fallback font size value, if neither exist. + Returns the engine fallback font size value, if neither exist (see [member ThemeDB.fallback_font_size]). </description> </method> <method name="get_font_size_list" qualifiers="const"> @@ -195,7 +195,7 @@ <param index="1" name="theme_type" type="StringName" /> <description> Returns the icon property defined by [param name] and [param theme_type], if it exists. - Returns the engine fallback icon value if the property doesn't exist. Use [method has_icon] to check for existence. + Returns the engine fallback icon value if the property doesn't exist (see [member ThemeDB.fallback_icon]). Use [method has_icon] to check for existence. </description> </method> <method name="get_icon_list" qualifiers="const"> @@ -217,7 +217,7 @@ <param index="1" name="theme_type" type="StringName" /> <description> Returns the [StyleBox] property defined by [param name] and [param theme_type], if it exists. - Returns the engine fallback stylebox value if the property doesn't exist. Use [method has_stylebox] to check for existence. + Returns the engine fallback stylebox value if the property doesn't exist (see [member ThemeDB.fallback_stylebox]). Use [method has_stylebox] to check for existence. </description> </method> <method name="get_stylebox_list" qualifiers="const"> @@ -240,7 +240,7 @@ <param index="2" name="theme_type" type="StringName" /> <description> Returns the theme property of [param data_type] defined by [param name] and [param theme_type], if it exists. - Returns the engine fallback icon value if the property doesn't exist. Use [method has_theme_item] to check for existence. + Returns the engine fallback icon value if the property doesn't exist (see [ThemeDB]). Use [method has_theme_item] to check for existence. [b]Note:[/b] This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic. </description> </method> @@ -542,15 +542,15 @@ </methods> <members> <member name="default_base_scale" type="float" setter="set_default_base_scale" getter="get_default_base_scale" default="0.0"> - The default base scale factor of this theme resource. Used by some controls to scale their visual properties based on the global scale factor. If this value is set to [code]0.0[/code], the global scale factor is used. + The default base scale factor of this theme resource. Used by some controls to scale their visual properties based on the global scale factor. If this value is set to [code]0.0[/code], the global scale factor is used (see [member ThemeDB.fallback_base_scale]). Use [method has_default_base_scale] to check if this value is valid. </member> <member name="default_font" type="Font" setter="set_default_font" getter="get_default_font"> - The default font of this theme resource. Used as the default value when trying to fetch a font resource that doesn't exist in this theme or is in invalid state. If the default font is also missing or invalid, the engine fallback value is used. + The default font of this theme resource. Used as the default value when trying to fetch a font resource that doesn't exist in this theme or is in invalid state. If the default font is also missing or invalid, the engine fallback value is used (see [member ThemeDB.fallback_font]). Use [method has_default_font] to check if this value is valid. </member> <member name="default_font_size" type="int" setter="set_default_font_size" getter="get_default_font_size" default="-1"> - The default font size of this theme resource. Used as the default value when trying to fetch a font size value that doesn't exist in this theme or is in invalid state. If the default font size is also missing or invalid, the engine fallback value is used. + The default font size of this theme resource. Used as the default value when trying to fetch a font size value that doesn't exist in this theme or is in invalid state. If the default font size is also missing or invalid, the engine fallback value is used (see [member ThemeDB.fallback_font_size]). Values below [code]0[/code] are invalid and can be used to unset the property. Use [method has_default_font_size] to check if this value is valid. </member> </members> diff --git a/doc/classes/ThemeDB.xml b/doc/classes/ThemeDB.xml new file mode 100644 index 0000000000..6003ffb28e --- /dev/null +++ b/doc/classes/ThemeDB.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ThemeDB" inherits="Object" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + An engine singleton providing access to static [Theme] information, such as default and project theme, and fallback values. + </brief_description> + <description> + This engine singleton provides access to static information about [Theme] resources used by the engine and by your projects. You can fetch the default engine theme, as well as your project configured theme. + [ThemeDB] also contains fallback values for theme properties. + </description> + <tutorials> + </tutorials> + <methods> + <method name="get_default_theme"> + <return type="Theme" /> + <description> + Returns a reference to the default engine [Theme]. This theme resource is responsible for the out-of-the-box look of [Control] nodes and cannot be overridden. + </description> + </method> + <method name="get_project_theme"> + <return type="Theme" /> + <description> + Returns a reference to the custom project [Theme]. This theme resources allows to override the default engine theme for every control node in the project. + To set the project theme, see [member ProjectSettings.gui/theme/custom]. + </description> + </method> + </methods> + <members> + <member name="fallback_base_scale" type="float" setter="set_fallback_base_scale" getter="get_fallback_base_scale" default="1.0"> + The fallback base scale factor of every [Control] node and [Theme] resource. Used when no other value is available to the control. + See also [member Theme.default_base_scale]. + </member> + <member name="fallback_font" type="Font" setter="set_fallback_font" getter="get_fallback_font"> + The fallback font of every [Control] node and [Theme] resource. Used when no other value is available to the control. + See also [member Theme.default_font]. + </member> + <member name="fallback_font_size" type="int" setter="set_fallback_font_size" getter="get_fallback_font_size" default="16"> + The fallback font size of every [Control] node and [Theme] resource. Used when no other value is available to the control. + See also [member Theme.default_font_size]. + </member> + <member name="fallback_icon" type="Texture2D" setter="set_fallback_icon" getter="get_fallback_icon"> + The fallback icon of every [Control] node and [Theme] resource. Used when no other value is available to the control. + </member> + <member name="fallback_stylebox" type="StyleBox" setter="set_fallback_stylebox" getter="get_fallback_stylebox"> + The fallback stylebox of every [Control] node and [Theme] resource. Used when no other value is available to the control. + </member> + </members> + <signals> + <signal name="fallback_changed"> + <description> + Emitted when one of the fallback values had been changed. Use it to refresh the look of controls that may rely on the fallback theme items. + </description> + </signal> + </signals> +</class> |