Base accessibility API.

This commit is contained in:
Pāvels Nadtočajevs
2025-03-21 16:42:23 +02:00
parent af2c713971
commit b106dfd4f9
124 changed files with 7631 additions and 181 deletions

View File

@ -126,6 +126,14 @@ int MenuButton::get_item_count() const {
void MenuButton::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
RID ae = get_accessibility_element();
ERR_FAIL_COND(ae.is_null());
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_BUTTON);
DisplayServer::get_singleton()->accessibility_update_set_popup_type(ae, DisplayServer::AccessibilityPopupType::POPUP_MENU);
} break;
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
popup->set_layout_direction((Window::LayoutDirection)get_layout_direction());
} break;
@ -218,7 +226,7 @@ MenuButton::MenuButton(const String &p_text) :
set_toggle_mode(true);
set_disable_shortcuts(false);
set_process_shortcut_input(true);
set_focus_mode(FOCUS_NONE);
set_focus_mode(FOCUS_ACCESSIBILITY);
set_action_mode(ACTION_MODE_BUTTON_PRESS);
popup = memnew(PopupMenu);