SIZE_FLAGS_FILL → SIZE_FILL, SIZE_FLAGS_SHRINK_END → SIZE_SHRINK_END. The _FLAGS_ prefix was removed in Godot 4.6. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
41 lines
1.2 KiB
GDScript
41 lines
1.2 KiB
GDScript
@tool
|
|
class_name ImplantHeader
|
|
extends VBoxContainer
|
|
## Panel header — title + optional subtitle.
|
|
|
|
var _title_label: Label
|
|
var _subtitle_label: Label
|
|
|
|
|
|
func _init(title: String = "", subtitle: String = "") -> void:
|
|
_title_label = Label.new()
|
|
_title_label.text = title
|
|
_title_label.name = "Title"
|
|
|
|
_subtitle_label = Label.new()
|
|
_subtitle_label.text = subtitle
|
|
_subtitle_label.name = "Subtitle"
|
|
|
|
|
|
func _ready() -> void:
|
|
add_theme_constant_override("separation", 0)
|
|
size_flags_horizontal = Control.SIZE_FILL
|
|
_title_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
_subtitle_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
add_child(_title_label)
|
|
add_child(_subtitle_label)
|
|
|
|
|
|
func set_content(title: String, subtitle: String = "") -> void:
|
|
_title_label.text = title
|
|
_subtitle_label.text = subtitle
|
|
_subtitle_label.visible = not subtitle.is_empty()
|
|
|
|
|
|
func apply_implant_theme(t: ImplantTheme) -> void:
|
|
_title_label.add_theme_font_size_override("font_size", t.font_header)
|
|
_title_label.add_theme_color_override("font_color", t.text_primary)
|
|
|
|
_subtitle_label.add_theme_font_size_override("font_size", t.font_small)
|
|
_subtitle_label.add_theme_color_override("font_color", t.text_dim)
|