feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -142,6 +142,45 @@ void TabContainer::gui_input(const Ref<InputEvent> &p_event) {
void TabContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ACCESSIBILITY_INVALIDATE: {
tab_panels.clear();
} break;
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
RID ae = get_accessibility_element();
ERR_FAIL_COND(ae.is_null());
int tab_index = 0;
int tab_cur = tab_bar->get_current_tab();
for (int i = 0; i < get_child_count(); i++) {
Node *child_node = get_child(i);
Window *child_wnd = Object::cast_to<Window>(child_node);
if (child_wnd && !child_wnd->is_embedded()) {
continue;
}
if (child_node->is_part_of_edited_scene()) {
continue;
}
Control *control = as_sortable_control(child_node, SortableVisibilityMode::IGNORE);
if (!control || control == tab_bar || children_removing.has(control)) {
DisplayServer::get_singleton()->accessibility_update_add_child(ae, child_node->get_accessibility_element());
} else {
if (!tab_panels.has(child_node)) {
tab_panels[child_node] = DisplayServer::get_singleton()->accessibility_create_sub_element(ae, DisplayServer::AccessibilityRole::ROLE_TAB_PANEL);
}
RID panel = tab_panels[child_node];
RID tab = tab_bar->get_tab_accessibility_element(tab_index);
DisplayServer::get_singleton()->accessibility_update_add_related_controls(tab, panel);
DisplayServer::get_singleton()->accessibility_update_add_related_labeled_by(panel, tab);
DisplayServer::get_singleton()->accessibility_update_set_flag(panel, DisplayServer::AccessibilityFlags::FLAG_HIDDEN, tab_index != tab_cur);
DisplayServer::get_singleton()->accessibility_update_add_child(panel, child_node->get_accessibility_element());
tab_index++;
}
}
} break;
case NOTIFICATION_ENTER_TREE: {
// If some nodes happen to be renamed outside the tree, the tab names need to be updated manually.
if (get_tab_count() > 0) {
@ -247,6 +286,7 @@ void TabContainer::_on_theme_changed() {
tab_bar->add_theme_font_size_override(SceneStringName(font_size), theme_cache.tab_font_size);
tab_bar->add_theme_constant_override(SNAME("h_separation"), theme_cache.icon_separation);
tab_bar->add_theme_constant_override(SNAME("tab_separation"), theme_cache.tab_separation);
tab_bar->add_theme_constant_override(SNAME("icon_max_width"), theme_cache.icon_max_width);
tab_bar->add_theme_constant_override(SNAME("outline_size"), theme_cache.outline_size);
@ -555,6 +595,7 @@ void TabContainer::add_child_notify(Node *p_child) {
if (get_tab_count() == 1) {
queue_redraw();
}
queue_accessibility_update();
p_child->connect("renamed", callable_mp(this, &TabContainer::_refresh_tab_names));
p_child->connect(SceneStringName(visibility_changed), callable_mp(this, &TabContainer::_on_tab_visibility_changed).bind(c));
@ -578,11 +619,17 @@ void TabContainer::move_child_notify(Node *p_child) {
}
_refresh_tab_indices();
queue_accessibility_update();
}
void TabContainer::remove_child_notify(Node *p_child) {
Container::remove_child_notify(p_child);
if (tab_panels.has(p_child)) {
DisplayServer::get_singleton()->accessibility_free_element(tab_panels[p_child]);
tab_panels.erase(p_child);
}
if (p_child == tab_bar) {
return;
}
@ -606,6 +653,7 @@ void TabContainer::remove_child_notify(Node *p_child) {
if (get_tab_count() == 0) {
queue_redraw();
}
queue_accessibility_update();
p_child->remove_meta("_tab_index");
p_child->remove_meta("_tab_name");
@ -725,7 +773,7 @@ void TabContainer::set_tab_focus_mode(Control::FocusMode p_focus_mode) {
}
Control::FocusMode TabContainer::get_tab_focus_mode() const {
return tab_bar->get_focus_mode();
return tab_bar->get_focus_mode_with_recursive();
}
void TabContainer::set_clip_tabs(bool p_clip_tabs) {
@ -761,7 +809,6 @@ void TabContainer::set_all_tabs_in_front(bool p_in_front) {
remove_child(tab_bar);
add_child(tab_bar, false, all_tabs_in_front ? INTERNAL_MODE_FRONT : INTERNAL_MODE_BACK);
tab_bar->force_parent_owned();
}
bool TabContainer::is_all_tabs_in_front() const {
@ -951,7 +998,7 @@ void TabContainer::set_popup(Node *p_popup) {
Popup *TabContainer::get_popup() const {
if (popup_obj_id.is_valid()) {
Popup *popup = Object::cast_to<Popup>(ObjectDB::get_instance(popup_obj_id));
Popup *popup = ObjectDB::get_instance<Popup>(popup_obj_id);
if (popup) {
return popup;
} else {
@ -1078,6 +1125,7 @@ void TabContainer::_bind_methods() {
BIND_ENUM_CONSTANT(POSITION_MAX);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, TabContainer, side_margin);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, TabContainer, tab_separation);
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, TabContainer, panel_style, "panel");
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, TabContainer, tabbar_style, "tabbar_background");