Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui_parts/settings_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func setup_tabs() -> void:
tab.toggle_mode = true
tab.action_mode = BaseButton.ACTION_MODE_BUTTON_PRESS
tab.focus_mode = Control.FOCUS_NONE
tab.theme_type_variation = "SideTab"
tab.theme_type_variation = "TabButton"
tab.toggled.connect(_on_tab_toggled.bind(tab_index))
tab.button_group = button_group
tab.button_pressed = (tab_index == focused_tab_index)
Expand Down
7 changes: 5 additions & 2 deletions src/ui_parts/settings_menu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ script = ExtResource("1_1gf4m")

[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 8

[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer"]
layout_mode = 2
Expand All @@ -35,6 +34,10 @@ focus_mode = 0
mouse_default_cursor_shape = 2
icon = ExtResource("2_ndyp7")

[node name="spacer" type="Control" parent="VBoxContainer"]
custom_minimum_size = Vector2(0, 8)
layout_mode = 2

[node name="BoxContainer" type="BoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
Expand All @@ -44,7 +47,7 @@ vertical = true
custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 0
theme_override_constants/separation = 8
theme_override_constants/separation = 0

[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/BoxContainer"]
layout_mode = 2
Expand Down
42 changes: 20 additions & 22 deletions src/utils/ThemeUtils.gd
Original file line number Diff line number Diff line change
Expand Up @@ -785,28 +785,26 @@ static func _setup_button(theme: Theme) -> void:
theme.set_stylebox("hover_pressed", "TextButton", text_button_empty_stylebox)
theme.set_stylebox("disabled", "TextButton", text_button_empty_stylebox)

theme.add_type("SideTab")
theme.set_type_variation("SideTab", "Button")

var normal_sidetab_stylebox := StyleBoxFlat.new()
normal_sidetab_stylebox.draw_center = false
normal_sidetab_stylebox.content_margin_left = 6.0
normal_sidetab_stylebox.content_margin_right = 6.0
normal_sidetab_stylebox.content_margin_bottom = 3.0
normal_sidetab_stylebox.content_margin_top = 3.0
theme.set_stylebox("normal", "SideTab", normal_sidetab_stylebox)

var hovered_sidetab_stylebox := normal_sidetab_stylebox.duplicate()
hovered_sidetab_stylebox.bg_color = softer_intermediate_hover_color
hovered_sidetab_stylebox.draw_center = true
theme.set_stylebox("hover", "SideTab", hovered_sidetab_stylebox)

var pressed_sidetab_stylebox := normal_sidetab_stylebox.duplicate()
pressed_sidetab_stylebox.bg_color = selected_tab_color
pressed_sidetab_stylebox.border_color = selected_tab_border_color
pressed_sidetab_stylebox.border_width_bottom = 2
theme.set_stylebox("pressed", "SideTab", pressed_sidetab_stylebox)
theme.set_stylebox("hover_pressed", "SideTab", pressed_sidetab_stylebox)
theme.add_type("TabButton")
theme.set_type_variation("TabButton", "Button")

var normal_tab_stylebox := StyleBoxFlat.new()
normal_tab_stylebox.draw_center = false
normal_tab_stylebox.set_content_margin_all(8)
theme.set_stylebox("normal", "TabButton", normal_tab_stylebox)

var hovered_tab_stylebox := normal_tab_stylebox.duplicate()
hovered_tab_stylebox.bg_color = softer_intermediate_hover_color
hovered_tab_stylebox.draw_center = true
theme.set_stylebox("hover", "TabButton", hovered_tab_stylebox)

var pressed_tab_stylebox := normal_tab_stylebox.duplicate()
pressed_tab_stylebox.draw_center = true
pressed_tab_stylebox.bg_color = selected_tab_color
pressed_tab_stylebox.border_color = selected_tab_border_color
pressed_tab_stylebox.border_width_bottom = 2
theme.set_stylebox("pressed", "TabButton", pressed_tab_stylebox)
theme.set_stylebox("hover_pressed", "TabButton", pressed_tab_stylebox)

theme.add_type("Swatch")
theme.set_type_variation("Swatch", "Button")
Expand Down