mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 22:15:39 +00:00
e3a0d23dd9
Another attempt to merge? On branch feat/godot Changes to be committed: modified: config/retrodeck/reference_lists/features.json modified: tools/configurator/TabContainer.gd modified: tools/configurator/components/bios_check/bios_popup_content.tscn modified: tools/configurator/components/popup.tscn modified: tools/configurator/main.tscn modified: tools/configurator/project.godot modified: tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres modified: tools/configurator/tk_about.gd
28 lines
805 B
GDScript
28 lines
805 B
GDScript
extends TabContainer
|
|
|
|
func _ready():
|
|
focusFirstFocusableChild() #grab focus on first element to enable controller focusing
|
|
#
|
|
func _input(event):
|
|
if (event.is_action_pressed("next_tab")):
|
|
self.select_next_available()
|
|
focusFirstFocusableChild()
|
|
|
|
if (event.is_action_pressed("previous_tab")):
|
|
self.select_previous_available()
|
|
focusFirstFocusableChild()
|
|
|
|
func focusFirstFocusableChild():
|
|
var children = findElements(get_current_tab_control(), "Control")
|
|
for n: Control in children:
|
|
if (n.focus_mode == FOCUS_ALL):
|
|
n.grab_focus.call_deferred()
|
|
break
|
|
|
|
func findElements(node: Node, className: String, result: Array = []) -> Array:
|
|
if node.is_class(className):
|
|
result.push_back(node)
|
|
for child in node.get_children():
|
|
result = findElements(child, className, result)
|
|
return result
|