class_name TopBar extends Control ## The bar along the top of the main window, with the title, the Quiz and Statistics tabs ## and the buttons for things that are not part of a quiz. signal search_pressed signal sync_pressed signal shortcuts_pressed signal about_pressed signal qr_pressed ## Emitted when a tab is chosen: [code]&"quiz"[/code] or [code]&"statistics"[/code]. signal tab_selected(tab: StringName) @onready var sync_button: Button = $SyncButton @onready var quiz_tab: Button = $QuizTab @onready var statistics_tab: Button = $StatisticsTab func _ready() -> void: $SearchButton.pressed.connect(search_pressed.emit) sync_button.pressed.connect(sync_pressed.emit) $ShortcutsButton.pressed.connect(shortcuts_pressed.emit) $AboutButton.pressed.connect(about_pressed.emit) $QRButton.pressed.connect(qr_pressed.emit) quiz_tab.pressed.connect(tab_selected.emit.bind(&"quiz")) statistics_tab.pressed.connect(tab_selected.emit.bind(&"statistics")) ## Shows [param tab] as the chosen tab, without emitting [signal tab_selected]. func select_tab(tab: StringName) -> void: quiz_tab.set_pressed_no_signal(tab == &"quiz") statistics_tab.set_pressed_no_signal(tab == &"statistics")