32 #include "scene/gui/control.h" 33 #include "scene/gui/scroll_bar.h" 34 #include "scene/main/timer.h" 57 int selecting_line,selecting_column;
63 int from_line,from_column;
64 int to_line,to_column;
77 Color line_number_color;
79 Color font_selected_color;
83 Color member_variable_color;
84 Color selection_color;
86 Color breakpoint_color;
87 Color current_line_color;
88 Color brace_mismatch_color;
89 Color word_highlighted_color;
94 int breakpoint_gutter_width;
105 ColorRegion(
const String& p_begin_key=
"",
const String& p_end_key=
"",
const Color &p_color=
Color(),
bool p_line_only=
false) { begin_key=p_begin_key; end_key=p_end_key; color=p_color; line_only=p_line_only || p_end_key==
""; eq=begin_key==end_key; }
117 int width_cache : 24;
129 void _update_line_cache(
int p_line)
const;
134 void set_tab_size(
int p_tab_size);
137 int get_line_width(
int p_line)
const;
138 int get_max_width()
const;
140 void set(
int p_line,
const String& p_string);
141 void set_marked(
int p_line,
bool p_marked) { text[p_line].marked=p_marked; }
142 bool is_marked(
int p_line)
const {
return text[p_line].marked; }
143 void set_breakpoint(
int p_line,
bool p_breakpoint) { text[p_line].breakpoint=p_breakpoint; }
144 bool is_breakpoint(
int p_line)
const {
return text[p_line].breakpoint; }
145 void insert(
int p_at,
const String& p_text);
146 void remove(
int p_at);
147 int size()
const {
return text.size(); }
150 _FORCE_INLINE_
const String& operator[](
int p_line)
const {
return text[p_line].data; }
151 Text() { tab_size=4; }
154 struct TextOperation {
163 int from_line,from_column;
164 int to_line, to_column;
166 uint32_t prev_version;
172 TextOperation current_op;
178 void _do_text_op(
const TextOperation& p_op,
bool p_reverse);
184 Color custom_bg_color;
189 bool completion_enabled;
192 bool completion_active;
193 String completion_current;
195 int completion_index;
197 int completion_line_ofs;
199 int completion_hint_offset;
207 uint32_t saved_version;
211 bool syntax_coloring;
214 Timer *caret_blink_timer;
215 bool caret_blink_enabled;
221 bool cursor_changed_dirty;
222 bool text_changed_dirty;
225 bool draw_breakpoint_gutter;
226 int breakpoint_gutter_width;
228 bool highlight_all_occurrences;
229 bool scroll_past_end_of_file_enabled;
230 bool auto_brace_completion_enabled;
231 bool brace_matching_enabled;
236 uint64_t last_dblclk;
239 Timer *click_select_held;
242 bool updating_scrolls;
249 bool next_operation_is_complex;
254 int get_visible_rows()
const;
256 int get_char_count();
258 int get_char_pos_for(
int p_px,
String p_pos)
const;
259 int get_column_x_offset(
int p_column,
String p_pos);
261 void adjust_viewport_to_cursor();
262 void _scroll_moved(
double);
263 void _update_scrollbars();
264 void _click_selection_held();
266 void _pre_shift_selection();
267 void _post_shift_selection();
269 void _scroll_lines_up();
270 void _scroll_lines_down();
273 Size2 get_minimum_size();
275 int get_row_height()
const;
277 void _reset_caret_blink_timer();
278 void _toggle_draw_caret();
280 void _update_caches();
281 void _cursor_changed_emit();
282 void _text_changed_emit();
284 void _push_current_op();
288 void _base_insert_text(
int p_line,
int p_column,
const String& p_text,
int &r_end_line,
int &r_end_column);
289 String _base_get_text(
int p_from_line,
int p_from_column,
int p_to_line,
int p_to_column)
const;
290 void _base_remove_text(
int p_from_line,
int p_from_column,
int p_to_line,
int p_to_column);
292 int _get_column_pos_of_word(
const String &p_key,
const String &p_search,
int p_from_column);
294 DVector<int> _search_bind(
const String &p_key,uint32_t p_search_flags,
int p_from_line,
int p_from_column)
const;
297 void _cancel_completion();
298 void _cancel_code_hint();
299 void _confirm_completion();
300 void _update_completion_candidates();
302 void _get_mouse_pos(
const Point2i& p_mouse,
int &r_row,
int &r_col)
const;
308 void _insert_text(
int p_line,
int p_column,
const String& p_text,
int *r_end_line=NULL,
int *r_end_char=NULL);
309 void _remove_text(
int p_from_line,
int p_from_column,
int p_to_line,
int p_to_column);
310 void _insert_text_at_cursor(
const String& p_text);
312 void _notification(
int p_what);
314 void _consume_pair_symbol(CharType ch);
315 void _consume_backspace_for_pair_symbol(
int prev_line,
int prev_column);
317 static void _bind_methods();
326 SEARCH_WHOLE_WORDS=2,
330 virtual CursorShape get_cursor_shape(
const Point2& p_pos=
Point2i())
const;
335 void begin_complex_operation();
336 void end_complex_operation();
338 void set_text(
String p_text);
339 void insert_text_at_cursor(
const String& p_text);
340 void insert_at(
const String& p_text,
int at);
341 int get_line_count()
const;
342 void set_line_as_marked(
int p_line,
bool p_marked);
343 void set_line_as_breakpoint(
int p_line,
bool p_breakpoint);
344 bool is_line_set_as_breakpoint(
int p_line)
const;
345 void get_breakpoints(
List<int> *p_breakpoints)
const;
347 String get_line(
int line)
const;
348 void set_line(
int line,
String new_text);
349 void backspace_at_cursor();
351 void indent_selection_left();
352 void indent_selection_right();
354 inline void set_scroll_pass_end_of_file(
bool p_enabled) {
355 scroll_past_end_of_file_enabled = p_enabled;
358 inline void set_auto_brace_completion(
bool p_enabled) {
359 auto_brace_completion_enabled = p_enabled;
361 inline void set_brace_matching(
bool p_enabled) {
362 brace_matching_enabled=p_enabled;
365 inline void set_callhint_settings(
bool below,
Vector2 offset) {
366 callhint_below = below;
367 callhint_offset = offset;
369 void set_auto_indent(
bool p_auto_indent);
371 void cursor_set_column(
int p_col,
bool p_adjust_viewport=
true);
372 void cursor_set_line(
int p_row,
bool p_adjust_viewport=
true);
374 int cursor_get_column()
const;
375 int cursor_get_line()
const;
377 bool cursor_get_blink_enabled()
const;
378 void cursor_set_blink_enabled(
const bool p_enabled);
380 float cursor_get_blink_speed()
const;
381 void cursor_set_blink_speed(
const float p_speed);
383 void set_readonly(
bool p_readonly);
385 void set_max_chars(
int p_max_chars);
386 void set_wrap(
bool p_wrap);
390 void set_syntax_coloring(
bool p_enabled);
391 bool is_syntax_coloring_enabled()
const;
397 void select(
int p_from_line,
int p_from_column,
int p_to_line,
int p_to_column);
400 void set_highlight_all_occurrences(
const bool p_enabled);
401 bool is_selection_active()
const;
402 int get_selection_from_line()
const;
403 int get_selection_from_column()
const;
404 int get_selection_to_line()
const;
405 int get_selection_to_column()
const;
406 String get_selection_text()
const;
408 String get_word_under_cursor()
const;
410 bool search(
const String &p_key,uint32_t p_search_flags,
int p_from_line,
int p_from_column,
int &r_line,
int &r_column)
const;
414 void clear_undo_history();
416 void set_tab_size(
const int p_size);
417 void set_draw_tabs(
bool p_draw);
418 bool is_drawing_tabs()
const;
420 void set_insert_mode(
bool p_enabled);
421 bool is_insert_mode()
const;
423 void add_keyword_color(
const String& p_keyword,
const Color& p_color);
425 void set_symbol_color(
const Color& p_color);
426 void set_custom_bg_color(
const Color& p_color);
429 int get_v_scroll()
const;
430 void set_v_scroll(
int p_scroll);
432 int get_h_scroll()
const;
433 void set_h_scroll(
int p_scroll);
435 uint32_t get_version()
const;
436 uint32_t get_saved_version()
const;
437 void tag_saved_version();
439 void set_show_line_numbers(
bool p_show);
441 void set_draw_breakpoint_gutter(
bool p_draw);
442 bool is_drawing_breakpoint_gutter()
const;
444 void set_breakpoint_gutter_width(
int p_gutter_width);
445 int get_breakpoint_gutter_width()
const;
449 void set_completion(
bool p_enabled,
const Vector<String>& p_prefixes);
451 void set_code_hint(
const String& p_hint);
452 void query_code_comple();
454 String get_text_for_completion();
456 virtual bool is_text_field()
const;
462 #endif // TEXT_EDIT_H
Definition: math_2d.h:422
Definition: math_2d.h:369
Definition: text_edit.h:37
Definition: string_db.h:48
Definition: text_edit.h:116
Definition: text_edit.h:110