- Introduced `EmojiQuickGrid`, `FontPresetPicker`, and `PresetSizeToggle` classes for emoji selection, font presets, and size toggles respectively. - Implemented configuration methods for each component to handle dynamic content and theming. - Created tests for the new components to ensure functionality and integration with the existing UI. - Added a comprehensive architecture specification for Phase 7 UI Polish detailing scope, implementation, and validation strategies. - Updated existing theme handling to support new UI elements and ensure consistent styling across the application.
18 lines
1.0 KiB
GDScript
18 lines
1.0 KiB
GDScript
class_name FontPresetPicker
|
|
extends HBoxContainer
|
|
signal preset_selected(id: String)
|
|
var _selected_id: String = ""
|
|
var _group: ButtonGroup = ButtonGroup.new()
|
|
func configure(presets: Array[Dictionary], selected_id: String, theme: Variant = null) -> void:
|
|
for child: Node in get_children(): child.queue_free()
|
|
_selected_id = selected_id
|
|
for item: Dictionary in presets:
|
|
var id: String = String(item.get("id", "")); if id.is_empty(): continue
|
|
var button := Button.new(); button.text = String(item.get("label", id)); button.custom_minimum_size = Vector2(44,44); button.toggle_mode = true; button.button_group = _group
|
|
if item.get("font", null) is Font: button.add_theme_font_override("font", item["font"])
|
|
button.pressed.connect(func() -> void: set_selected(id, true)); add_child(button); button.set_pressed_no_signal(id == selected_id)
|
|
func set_selected(id: String, emit_signal: bool = false) -> void:
|
|
_selected_id = id
|
|
if emit_signal: preset_selected.emit(id)
|
|
func get_selected_id() -> String: return _selected_id
|