Skip to content

Commit

Permalink
Use bound theme properties for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizov committed Sep 12, 2023
1 parent f40364a commit c6ee269
Show file tree
Hide file tree
Showing 41 changed files with 613 additions and 91 deletions.
2 changes: 2 additions & 0 deletions core/doc_data.h
Expand Up @@ -442,6 +442,8 @@ class DocData {
String data_type;
String description;
String default_value;
bool inherited = false;
String inherits;
bool operator<(const ThemeItemDoc &p_theme_item) const {
// First sort by the data type, then by name.
if (data_type == p_theme_item.data_type) {
Expand Down
26 changes: 26 additions & 0 deletions doc/classes/AcceptDialog.xml
Expand Up @@ -99,9 +99,35 @@
</signal>
</signals>
<theme_items>
<theme_item name="title_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="title_outline_modulate" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="buttons_separation" data_type="constant" type="int" default="10">
The size of the vertical space between the dialog's content and the button row.
</theme_item>
<theme_item name="close_h_offset" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="close_v_offset" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="resize_margin" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="title_height" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="title_outline_size" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="title_font" data_type="font" type="Font">
</theme_item>
<theme_item name="title_font_size" data_type="font_size" type="int">
</theme_item>
<theme_item name="close" data_type="icon" type="Texture2D">
</theme_item>
<theme_item name="close_pressed" data_type="icon" type="Texture2D">
</theme_item>
<theme_item name="embedded_border" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="embedded_unfocused_border" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="panel" data_type="style" type="StyleBox">
The panel that fills the background of the window.
</theme_item>
Expand Down
14 changes: 14 additions & 0 deletions doc/classes/Button.xml
Expand Up @@ -131,20 +131,34 @@
<theme_item name="font_size" data_type="font_size" type="int">
Font size of the [Button]'s text.
</theme_item>
<theme_item name="icon" data_type="icon" type="Texture2D">
</theme_item>
<theme_item name="disabled" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is disabled.
</theme_item>
<theme_item name="disabled_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="focus" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is focused. The [code]focus[/code] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
</theme_item>
<theme_item name="hover" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is being hovered.
</theme_item>
<theme_item name="hover_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="hover_pressed" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="hover_pressed_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="normal" data_type="style" type="StyleBox">
Default [StyleBox] for the [Button].
</theme_item>
<theme_item name="normal_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="pressed" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is being pressed.
</theme_item>
<theme_item name="pressed_mirrored" data_type="style" type="StyleBox">
</theme_item>
</theme_items>
</class>
26 changes: 26 additions & 0 deletions doc/classes/CheckBox.xml
Expand Up @@ -36,12 +36,26 @@
<theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The [CheckBox] text's font color when it's pressed.
</theme_item>
<theme_item name="icon_disabled_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_focus_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_hover_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_hover_pressed_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_normal_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_pressed_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="check_v_offset" data_type="constant" type="int" default="0">
The vertical offset used when rendering the check icons (in pixels).
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="4">
The separation between the check icon and the text (in pixels). Negative values will be treated as [code]0[/code] when used.
</theme_item>
<theme_item name="icon_max_width" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
[b]Note:[/b] If using a font with [member FontFile.multichannel_signed_distance_field] enabled, its [member FontFile.msdf_pixel_range] must be set to at least [i]twice[/i] the value of [theme_item outline_size] for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
Expand All @@ -58,6 +72,8 @@
<theme_item name="checked_disabled" data_type="icon" type="Texture2D">
The check icon to display when the [CheckBox] is checked and is disabled.
</theme_item>
<theme_item name="icon" data_type="icon" type="Texture2D">
</theme_item>
<theme_item name="radio_checked" data_type="icon" type="Texture2D">
The check icon to display when the [CheckBox] is configured as a radio button and is checked.
</theme_item>
Expand All @@ -79,20 +95,30 @@
<theme_item name="disabled" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is disabled.
</theme_item>
<theme_item name="disabled_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="focus" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is focused. The [code]focus[/code] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
</theme_item>
<theme_item name="hover" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is hovered.
</theme_item>
<theme_item name="hover_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="hover_pressed" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is hovered and pressed.
</theme_item>
<theme_item name="hover_pressed_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="normal" data_type="style" type="StyleBox">
The [StyleBox] to display as a background.
</theme_item>
<theme_item name="normal_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="pressed" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is pressed.
</theme_item>
<theme_item name="pressed_mirrored" data_type="style" type="StyleBox">
</theme_item>
</theme_items>
</class>
26 changes: 26 additions & 0 deletions doc/classes/CheckButton.xml
Expand Up @@ -35,12 +35,26 @@
<theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The [CheckButton] text's font color when it's pressed.
</theme_item>
<theme_item name="icon_disabled_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_focus_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_hover_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_hover_pressed_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_normal_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_pressed_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="check_v_offset" data_type="constant" type="int" default="0">
The vertical offset used when rendering the toggle icons (in pixels).
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="4">
The separation between the toggle icon and the text (in pixels). Negative values will be treated as [code]0[/code] when used.
</theme_item>
<theme_item name="icon_max_width" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
[b]Note:[/b] If using a font with [member FontFile.multichannel_signed_distance_field] enabled, its [member FontFile.msdf_pixel_range] must be set to at least [i]twice[/i] the value of [theme_item outline_size] for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
Expand All @@ -63,6 +77,8 @@
<theme_item name="checked_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked (for right-to-left layouts).
</theme_item>
<theme_item name="icon" data_type="icon" type="Texture2D">
</theme_item>
<theme_item name="unchecked" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked (for left-to-right layouts).
</theme_item>
Expand All @@ -78,20 +94,30 @@
<theme_item name="disabled" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is disabled.
</theme_item>
<theme_item name="disabled_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="focus" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is focused. The [code]focus[/code] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
</theme_item>
<theme_item name="hover" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is hovered.
</theme_item>
<theme_item name="hover_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="hover_pressed" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is hovered and pressed.
</theme_item>
<theme_item name="hover_pressed_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="normal" data_type="style" type="StyleBox">
The [StyleBox] to display as a background.
</theme_item>
<theme_item name="normal_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="pressed" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is pressed.
</theme_item>
<theme_item name="pressed_mirrored" data_type="style" type="StyleBox">
</theme_item>
</theme_items>
</class>
5 changes: 2 additions & 3 deletions doc/classes/CodeEdit.xml
Expand Up @@ -654,9 +654,6 @@
<theme_item name="completion_existing_color" data_type="color" type="Color" default="Color(0.87, 0.87, 0.87, 0.13)">
Background highlight [Color] for matching text in code completion options.
</theme_item>
<theme_item name="completion_font_color" data_type="color" type="Color" default="Color(0.67, 0.67, 0.67, 1)">
Font [Color] for the code completion popup.
</theme_item>
<theme_item name="completion_scroll_color" data_type="color" type="Color" default="Color(1, 1, 1, 0.29)">
[Color] of the scrollbar in the code completion popup.
</theme_item>
Expand Down Expand Up @@ -708,6 +705,8 @@
<theme_item name="word_highlighted_color" data_type="color" type="Color" default="Color(0.8, 0.9, 0.9, 0.15)">
Sets the highlight [Color] of multiple occurrences. [member TextEdit.highlight_all_occurrences] has to be enabled.
</theme_item>
<theme_item name="caret_width" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="completion_lines" data_type="constant" type="int" default="7">
Max number of options to display in the code completion popup at any one time.
</theme_item>
Expand Down
2 changes: 2 additions & 0 deletions doc/classes/ColorPicker.xml
Expand Up @@ -153,6 +153,8 @@
<theme_item name="margin" data_type="constant" type="int" default="4">
The margin around the [ColorPicker].
</theme_item>
<theme_item name="separation" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="sv_height" data_type="constant" type="int" default="256">
The height of the saturation-value selection box.
</theme_item>
Expand Down
30 changes: 30 additions & 0 deletions doc/classes/ColorPickerButton.xml
Expand Up @@ -68,15 +68,31 @@
<theme_item name="font_hover_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the [ColorPickerButton] is being hovered.
</theme_item>
<theme_item name="font_hover_pressed_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [ColorPickerButton].
</theme_item>
<theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(0.8, 0.8, 0.8, 1)">
Text [Color] used when the [ColorPickerButton] is being pressed.
</theme_item>
<theme_item name="icon_disabled_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_focus_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_hover_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_hover_pressed_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_normal_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="icon_pressed_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="4">
The horizontal space between [ColorPickerButton]'s icon and text.
</theme_item>
<theme_item name="icon_max_width" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
[b]Note:[/b] If using a font with [member FontFile.multichannel_signed_distance_field] enabled, its [member FontFile.msdf_pixel_range] must be set to at least [i]twice[/i] the value of [theme_item outline_size] for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
Expand All @@ -90,20 +106,34 @@
<theme_item name="bg" data_type="icon" type="Texture2D">
The background of the color preview rect on the button.
</theme_item>
<theme_item name="icon" data_type="icon" type="Texture2D">
</theme_item>
<theme_item name="disabled" data_type="style" type="StyleBox">
[StyleBox] used when the [ColorPickerButton] is disabled.
</theme_item>
<theme_item name="disabled_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="focus" data_type="style" type="StyleBox">
[StyleBox] used when the [ColorPickerButton] is focused. The [code]focus[/code] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
</theme_item>
<theme_item name="hover" data_type="style" type="StyleBox">
[StyleBox] used when the [ColorPickerButton] is being hovered.
</theme_item>
<theme_item name="hover_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="hover_pressed" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="hover_pressed_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="normal" data_type="style" type="StyleBox">
Default [StyleBox] for the [ColorPickerButton].
</theme_item>
<theme_item name="normal_mirrored" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="pressed" data_type="style" type="StyleBox">
[StyleBox] used when the [ColorPickerButton] is being pressed.
</theme_item>
<theme_item name="pressed_mirrored" data_type="style" type="StyleBox">
</theme_item>
</theme_items>
</class>
32 changes: 32 additions & 0 deletions doc/classes/ConfirmationDialog.xml
Expand Up @@ -34,4 +34,36 @@
<member name="size" type="Vector2i" setter="set_size" getter="get_size" overrides="Window" default="Vector2i(200, 100)" />
<member name="title" type="String" setter="set_title" getter="get_title" overrides="Window" default="&quot;Please Confirm...&quot;" />
</members>
<theme_items>
<theme_item name="title_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="title_outline_modulate" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
<theme_item name="buttons_separation" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="close_h_offset" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="close_v_offset" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="resize_margin" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="title_height" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="title_outline_size" data_type="constant" type="int" default="0">
</theme_item>
<theme_item name="title_font" data_type="font" type="Font">
</theme_item>
<theme_item name="title_font_size" data_type="font_size" type="int">
</theme_item>
<theme_item name="close" data_type="icon" type="Texture2D">
</theme_item>
<theme_item name="close_pressed" data_type="icon" type="Texture2D">
</theme_item>
<theme_item name="embedded_border" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="embedded_unfocused_border" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="panel" data_type="style" type="StyleBox">
</theme_item>
</theme_items>
</class>

0 comments on commit c6ee269

Please sign in to comment.