aboutsummaryrefslogtreecommitdiff
path: root/ui/option_set/option_set_list.gd
diff options
context:
space:
mode:
Diffstat (limited to 'ui/option_set/option_set_list.gd')
-rw-r--r--ui/option_set/option_set_list.gd38
1 files changed, 10 insertions, 28 deletions
diff --git a/ui/option_set/option_set_list.gd b/ui/option_set/option_set_list.gd
index fda2c04..9f784f9 100644
--- a/ui/option_set/option_set_list.gd
+++ b/ui/option_set/option_set_list.gd
@@ -26,9 +26,9 @@ var selected_idx := -1
var selected_item := ""
var is_dirty := true
-var normal_style : StyleBoxFlat
-var selected_style : StyleBoxFlat
-var border_size := 5
+var normal_style : StyleBox
+var selected_style : StyleBox
+var border_size := 2
onready var font : Font = get_font("font")
onready var screen_dpcm : float = float(OS.get_screen_dpi()) / 2.54
@@ -68,31 +68,6 @@ func _init():
sensor.connect("on_scroll", self, "pointer_input_on_scroll_handler")
-func _ready():
- var button_style := get_stylebox("pressed", "Button")
- var label_style := get_stylebox("normal", "Label")
-
- normal_style = StyleBoxFlat.new()
- normal_style.border_width_bottom = border_size
- normal_style.border_color = Color.white * 0.333
- normal_style.bg_color = Color.transparent
- normal_style.content_margin_left = label_style.content_margin_left
- normal_style.content_margin_top = label_style.content_margin_top
- normal_style.content_margin_right = label_style.content_margin_right
-
- var bg_color := button_style.bg_color as Color
- var corner_radius := button_style.corner_radius_top_right as int
- selected_style = StyleBoxFlat.new()
- selected_style.bg_color = bg_color
- selected_style.corner_radius_top_left = corner_radius
- selected_style.corner_radius_top_right = corner_radius
- selected_style.corner_radius_bottom_right = corner_radius
- selected_style.corner_radius_bottom_left = corner_radius
- selected_style.content_margin_left = label_style.content_margin_left
- selected_style.content_margin_top = label_style.content_margin_top
- selected_style.content_margin_right = label_style.content_margin_right
-
-
func mark_as_dirty():
is_dirty = true
@@ -292,3 +267,10 @@ func _clear_signals():
disconnect(it.signal, it.target, it.method)
+func _notification(what):
+ if what == NOTIFICATION_THEME_CHANGED:
+ normal_style = get_stylebox("normal", "OptionSetList")
+ selected_style = get_stylebox("selected", "OptionSetList")
+ border_size = normal_style.get_margin(MARGIN_BOTTOM)
+
+