class_name SettingsRow extends PanelContainer @onready var value_parent = $HBoxContainer/BoxContainer @onready var label = $HBoxContainer/Label var value_node var description = tr("no value was given to the row") func setup(description_: String, value): description = description_ if value is bool: value_node = CheckButton.new() value_node.button_pressed = value elif value is String: value_node = LineEdit.new() value_node.text = value func _ready(): if value_node != null: var c: Control = value_node c.size_flags_vertical = Control.SIZE_EXPAND_FILL c.size_flags_horizontal = Control.SIZE_EXPAND_FILL label.text = description value_parent.add_child(c) func get_value(): if value_node != null: if value_node is CheckButton: return value_node.button_pressed elif value_node is LineEdit: return value_node.text else: return null else: return null