MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _notification

Method _notification

scene/gui/text_edit.cpp:740–2051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

738}
739
740void TextEdit::_notification(int p_what) {
741 switch (p_what) {
742 case NOTIFICATION_EXIT_TREE:
743 case NOTIFICATION_ACCESSIBILITY_INVALIDATE: {
744 text.clear_accessibility();
745 accessibility_text_root_element_nl = RID();
746 } break;
747
748 case NOTIFICATION_ACCESSIBILITY_UPDATE: {
749 RID ae = get_accessibility_element();
750 ERR_FAIL_COND(ae.is_null());
751
752 DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_MULTILINE_TEXT_FIELD);
753 if (text.size() == 1 && text[0].is_empty()) {
754 DisplayServer::get_singleton()->accessibility_update_set_placeholder(ae, atr(placeholder_text));
755 }
756 if (!placeholder_text.is_empty() && get_accessibility_name().is_empty()) {
757 DisplayServer::get_singleton()->accessibility_update_set_name(ae, atr(placeholder_text));
758 }
759 DisplayServer::get_singleton()->accessibility_update_set_flag(ae, DisplayServer::AccessibilityFlags::FLAG_READONLY, !editable);
760 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SET_TEXT_SELECTION, callable_mp(this, &TextEdit::_accessibility_action_set_selection));
761 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_REPLACE_SELECTED_TEXT, callable_mp(this, &TextEdit::_accessibility_action_replace_selected));
762 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SET_VALUE, callable_mp(this, &TextEdit::_accessibility_action_set_value));
763 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SHOW_CONTEXT_MENU, callable_mp(this, &TextEdit::_accessibility_action_menu));
764
765 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SCROLL_DOWN, callable_mp(this, &TextEdit::_accessibility_scroll_down));
766 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SCROLL_LEFT, callable_mp(this, &TextEdit::_accessibility_scroll_left));
767 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SCROLL_RIGHT, callable_mp(this, &TextEdit::_accessibility_scroll_right));
768 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SCROLL_UP, callable_mp(this, &TextEdit::_accessibility_scroll_up));
769 DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SET_SCROLL_OFFSET, callable_mp(this, &TextEdit::_accessibility_scroll_set));
770
771 int first_vis_line = get_first_visible_line();
772 int row_height = get_line_height();
773 int xmargin_beg = Math::ceil(theme_cache.style_normal->get_margin(SIDE_LEFT)) + gutters_width + gutter_padding;
774 Size2 size = get_size();
775 bool rtl = is_layout_rtl();
776 int lines_drawn = 0;
777
778 RID selection_start;
779 RID selection_end;
780
781 for (int i = 0; i < text.size(); i++) {
782 text.update_accessibility(i, ae);
783 const Ref<TextParagraph> &ac_buf = text.get_line_data(i);
784 const Vector<RID> &text_aes = text.get_accessibility_elements(i);
785 int first_indent_line = 0;
786 float indent_ofs = 0.0;
787 if (text.is_indent_wrapped_lines()) {
788 _get_wrapped_indent_level(i, first_indent_line);
789 indent_ofs = MIN(text.get_indent_offset(i, rtl), wrap_at_column * 0.6);
790 }
791 for (int j = 0; j < text_aes.size(); j++) {
792 float text_off_x = 0.0;
793 float text_off_y = 0.0;
794 if (!editable) {
795 text_off_x = theme_cache.style_readonly->get_offset().x / 2;
796 text_off_x -= theme_cache.style_normal->get_offset().x / 2;
797 text_off_y = theme_cache.style_readonly->get_offset().y / 2;

Callers

nothing calls this directly

Calls 15

RIDClass · 0.85
ceilFunction · 0.85
get_sizeFunction · 0.85
MINFunction · 0.85
vformatFunction · 0.85
RTRFunction · 0.85
SIGNFunction · 0.85
roundFunction · 0.85
is_whitespaceFunction · 0.85
floorFunction · 0.85
is_inline_info_validFunction · 0.85

Tested by

no test coverage detected