mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-22 11:55:56 +00:00
Slightly better ItemList
handling, though for some reason I can't make it work in file selections.
This commit is contained in:
parent
065f62181b
commit
24d3ea596b
|
@ -73,11 +73,23 @@ func button_focus():
|
||||||
func texturebutton_focus():
|
func texturebutton_focus():
|
||||||
tts.speak("button", false)
|
tts.speak("button", false)
|
||||||
|
|
||||||
|
func item_list_item_focused(idx):
|
||||||
|
var tokens = PoolStringArray([])
|
||||||
|
var text = node.get_item_text(idx)
|
||||||
|
if text:
|
||||||
|
tokens.append(text)
|
||||||
|
text = node.get_item_tooltip(idx)
|
||||||
|
if text:
|
||||||
|
tokens.append(text)
|
||||||
|
tokens.append("%s of %s" % [idx + 1, node.get_item_count()])
|
||||||
|
tts.speak(tokens.join(": "))
|
||||||
|
|
||||||
func item_list_focus():
|
func item_list_focus():
|
||||||
var count = node.get_item_count()
|
var count = node.get_item_count()
|
||||||
var selected = node.get_selected_items()
|
var selected = node.get_selected_items()[0]
|
||||||
|
position_in_children = selected
|
||||||
tts.speak("list, %s %s" % [count, tts.singular_or_plural(count, "item", "items")], false)
|
tts.speak("list, %s %s" % [count, tts.singular_or_plural(count, "item", "items")], false)
|
||||||
tts.speak(selected, false)
|
item_list_item_focused(selected)
|
||||||
|
|
||||||
func item_list_item_selected(index):
|
func item_list_item_selected(index):
|
||||||
tts.speak("Selected", true)
|
tts.speak("Selected", true)
|
||||||
|
@ -107,8 +119,9 @@ func item_list_input(event):
|
||||||
node.accept_event()
|
node.accept_event()
|
||||||
position_in_children = node.get_item_count()-1
|
position_in_children = node.get_item_count()-1
|
||||||
if old_pos != position_in_children:
|
if old_pos != position_in_children:
|
||||||
var text = node.get_item_text(position_in_children)
|
node.unselect_all()
|
||||||
tts.speak("%s: %s of %s" % [text, position_in_children+1, node.get_item_count()], false)
|
node.select(position_in_children)
|
||||||
|
item_list_item_focused(position_in_children)
|
||||||
|
|
||||||
func label_focus():
|
func label_focus():
|
||||||
var text = node.text
|
var text = node.text
|
||||||
|
|
Loading…
Reference in New Issue
Block a user