The Battle for Wesnoth  1.19.8+dev
text_box_base.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2024
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 //#include "gui/core/event/dispatcher.hpp"
20 #include "font/text.hpp" // We want the file in src/
21 
22 #include <string>
23 
24 #include <functional>
25 
26 namespace gui2
27 {
28 
29 /**
30  * Abstract base class for text items.
31  *
32  * All other text classes should inherit from this base class.
33  *
34  * The NOTIFY_MODIFIED event is send when the text is modified.
35  *
36  * @todo Validate whether the NOTIFY_MODIFIED is always fired properly. The
37  * current implementation is added for some quick testing so some cases might
38  * be forgotten.
39  *
40  * Common signal handlers:
41  * - connect_signal_pre_key_press
42  */
44 {
45 
46 public:
47  text_box_base(const implementation::builder_styled_widget& builder, const std::string& control_type);
48 
50 
51  /** See @ref styled_widget::set_active. */
52  virtual void set_active(const bool active) override;
53 
54  /** See @ref styled_widget::get_active. */
55  virtual bool get_active() const override;
56 
57  /** See @ref styled_widget::get_state. */
58  virtual unsigned get_state() const override;
59 
60  /***** ***** ***** ***** expose some functions ***** ***** ***** *****/
61 
62  void set_maximum_length(const std::size_t maximum_length);
63 
64  /**
65  * Wrapper function, returns length of the text in pango column offsets.
66  * See @ref font::pango_text::get_length.
67  */
68  std::size_t get_length() const
69  {
70  return text_.get_length();
71  }
72 
73  /**
74  * Wrapper function, returns a vector with the lines.
75  * See @ref font::pango_text::get_lines.
76  */
77  std::vector<std::string> get_lines()
78  {
79  return text_.get_lines();
80  }
81 
82  /**
83  * Wrapper function, returns the line corresponding
84  * to index.
85  * See @ref font::pango_text::get_line.
86  */
87  PangoLayoutLine* get_line(int index)
88  {
89  return text_.get_line(index);
90  }
91 
92  /**
93  * Wrapper function, return the line number
94  * given the byte index.
95  * See @ref font::pango_text::get_line_num_from_offset.
96  */
97  int get_line_number(const unsigned offset)
98  {
99  return text_.get_line_num_from_offset(offset);
100  }
101 
102  /**
103  * Wrapper function, return the cursor position
104  * given the byte index.
105  * See @ref font::pango_text::get_cursor_pos_from_index.
106  */
107  point get_cursor_pos_from_index(const unsigned offset) const
108  {
109  return text_.get_cursor_pos_from_index(offset);
110  }
111 
112  /**
113  * Wrapper function, return number of lines.
114  * See @ref font::pango_text::get_lines_count.
115  */
116  unsigned get_lines_count() const
117  {
118  return text_.get_lines_count();
119  }
120 
121  /**
122  * Wrapper function, sets the area between column start and end
123  * offset to be highlighted in a specific color.
124  * See @ref font::pango_text::add_attribute_bg_color.
125  */
126  void set_highlight_area(const unsigned start_offset, const unsigned end_offset, const color_t& color)
127  {
128  text_.add_attribute_bg_color(start_offset, end_offset, color);
129  }
130 
131  /***** ***** ***** setters / getters for members ***** ****** *****/
132 
133  /**
134  * The set_value is virtual for the @ref password_box class.
135  *
136  * That class overrides the set_value function to replace it with asterisk.
137  * There might be more generic way to do it when more classes are needed.
138  */
139  virtual void set_value(const std::string& text);
140  std::string get_value() const
141  {
142  return text_.text();
143  }
144 
145  const std::string& text() const
146  {
147  return text_.text();
148  }
149 
150  std::string plain_text()
151  {
152  char* plain_text = nullptr;
153  pango_parse_markup(text().c_str(), text().size(), 0, nullptr, &plain_text, nullptr, nullptr);
154  return plain_text ? std::string(plain_text) : std::string();
155  }
156 
157  /**
158  * Registers a NOTIFY_MODIFIED handler.
159  *
160  * For convenience, the handler is invoked with a text_box_base reference
161  * as its first (and only) argument, rather than the usual widget reference.
162  *
163  * @todo Should we pass the other callback parameters to the handler?
164  */
165  template<typename Func>
166  void on_modified(const Func& f)
167  {
168  connect_signal<event::NOTIFY_MODIFIED>(
169  [f](widget& w, auto&&...) { f(dynamic_cast<text_box_base&>(w)); });
170  }
171 
172  /**
173  * Sets or clears the text selection.
174  *
175  * Setting the selection range will re-position the cursor depending on the
176  * selection direction, specified by the length's sign. Selecting beyond the
177  * start or end of the text is safe; the final selection will be limited
178  * accordingly.
179  *
180  * @note The range extents are measured in Unicode characters, not bytes.
181  * Using byte offsets may produce unexpected results depending on the
182  * text contents.
183  *
184  * @param start Start offset, in characters.
185  * @param length Selection length, in characters. If zero, the
186  * current selection is canceled. If negative, the
187  * selection extends towards the start of the text
188  * and the cursor will be re-positioned in that
189  * direction as well; otherwise the selection and
190  * cursor extend towards the end.
191  */
192  void set_selection(std::size_t start, int length);
193 
194  /**
195  * Set or unset whether text can be edited or not
196  * Text can only be copied and scrolled through when editable is false.
197  */
198  void set_editable(bool editable)
199  {
200  editable_ = editable;
201  update_canvas();
202  }
203 
204  /**
205  * Check whether text can be edited or not
206  */
207  bool is_editable() const
208  {
209  return editable_;
210  }
211 
212 protected:
213  /** Get length of composition text by IME **/
214  size_t get_composition_length() const;
215 
216  /**
217  * Moves the cursor to the end of the line.
218  *
219  * @param select Select the text from the original cursor
220  * position till the end of the line?
221  */
222  virtual void goto_end_of_line(const bool select = false) = 0;
223 
224  /**
225  * Moves the cursor to the end of all text.
226  *
227  * For a single line text this is the same as goto_end_of_line().
228  *
229  * @param select Select the text from the original cursor
230  * position till the end of the data?
231  */
232  virtual void goto_end_of_data(const bool select = false)
233  {
234  set_cursor(text_.get_length(), select);
235  }
236 
237  /**
238  * Moves the cursor to the beginning of the line
239  *
240  * @param select Select the text from the original cursor
241  * position till the beginning of the line?
242  */
243  virtual void goto_start_of_line(const bool select = false) = 0;
244 
245  /**
246  * Moves the cursor to the beginning of the data.
247  *
248  * @param select Select the text from the original cursor
249  * position till the beginning of the data?
250  */
251  virtual void goto_start_of_data(const bool select = false)
252  {
253  set_cursor(0, select);
254  }
255 
256  /** Selects all text. */
257  void select_all()
258  {
259  selection_start_ = 0;
260  goto_end_of_data(true);
261  }
262 
263  /**
264  * Moves the cursor at the wanted position.
265  *
266  * @param offset The wanted new cursor position.
267  * @param select Select the text from the original cursor
268  * position till the new position?
269  */
270  virtual void set_cursor(const std::size_t offset, const bool select);
271 
272  /**
273  * Inserts a character at the cursor.
274  *
275  * This function is preferred over set_text since it's optimized for
276  * updating the internal bookkeeping.
277  *
278  * @param unicode The unicode value of the character to insert.
279  */
280  virtual void insert_char(const std::string& unicode);
281 
282  /**
283  * Deletes the character.
284  *
285  * @param before_cursor If true it deletes the character before the
286  * cursor (backspace) else the character after
287  * the cursor (delete).
288  */
289  virtual void delete_char(const bool before_cursor) = 0;
290 
291  /** Deletes the current selection. */
292  virtual void delete_selection() = 0;
293 
294  /** Copies the current selection. */
295  virtual void copy_selection();
296 
297  /** Pastes the current selection. */
298  virtual void paste_selection();
299 
300  /***** ***** ***** ***** expose some functions ***** ***** ***** *****/
301 
302  point get_cursor_position(const unsigned column,
303  const unsigned line = 0) const
304  {
305  return text_.get_cursor_position(column, line);
306  }
307 
308  point get_column_line(const point& position) const
309  {
310  return text_.get_column_line(position);
311  }
312 
314  {
315  return font_family_;
316  }
317 
319  {
320  font_family_ = fclass;
322  }
323 
324  void set_font_size(const unsigned font_size)
325  {
326  text_.set_font_size(font_size);
327  }
328 
330  {
331  text_.set_font_style(font_style);
332  }
333 
334  void set_maximum_width(const int width)
335  {
336  text_.set_maximum_width(width);
337  }
338 
339  void set_maximum_height(const int height, const bool multiline)
340  {
341  text_.set_maximum_height(height, multiline);
342  }
343 
344  void set_ellipse_mode(const PangoEllipsizeMode ellipse_mode)
345  {
346  text_.set_ellipse_mode(ellipse_mode);
347  }
348 
349  /***** ***** ***** setters / getters for members ***** ****** *****/
350 
351  std::size_t get_selection_start() const
352  {
353  return selection_start_;
354  }
355  void set_selection_start(const std::size_t selection_start);
356 
357  std::size_t get_selection_length() const
358  {
359  return selection_length_;
360  }
361  void set_selection_length(const int selection_length);
362 
363  std::size_t get_composition_start() const
364  {
365  return ime_start_point_;
366  }
367 
368 public:
369  bool is_composing() const
370  {
371  return ime_composing_;
372  }
373 
374  void interrupt_composition();
375 
376  /** Note the order of the states must be the same as defined in
377  * settings.hpp. */
378  enum state_t {
383  };
384 
385 private:
386  void set_state(const state_t state);
387 
388  virtual void toggle_cursor_timer(bool enable);
389 
390  /** Implements blinking cursor functionality. */
391  virtual void cursor_timer_callback();
392 
393  virtual void reset_cursor_state();
394 
395  void update_mouse_cursor(bool enable);
396 
397  /**
398  * Current state of the widget.
399  *
400  * The state of the widget determines what to render and how the widget
401  * reacts to certain 'events'.
402  */
404 
405  /** The text entered in the widget. */
407 
408  /** font family */
410 
411  /** Cached version of the text without any pending IME modifications. */
412  std::string text_cached_;
413 
414  /** Start of the selected text. */
415  std::size_t selection_start_;
416 
417  /**
418  * Length of the selected text.
419  *
420  * * positive selection_len_ means selection to the right.
421  * * negative selection_len_ means selection to the left.
422  * * selection_len_ == 0 means no selection.
423  */
425 
426  /** If this text_box_base is editable */
427  bool editable_;
428 
429  // Values to support input method editors
432 
433  std::size_t cursor_timer_;
434 
435  unsigned short cursor_alpha_;
436  std::chrono::milliseconds cursor_blink_rate_;
437 
438  /****** handling of special keys first the pure virtuals *****/
439 
440  /**
441  * Every key can have several behaviors.
442  *
443  * Unmodified No modifier is pressed.
444  * Control The control key is pressed.
445  * Shift The shift key is pressed.
446  * Alt The alt key is pressed.
447  *
448  * If modifiers together do something else as the sum of the modifiers
449  * it's listed separately eg.
450  *
451  * Control Moves 10 steps at the time.
452  * Shift Selects the text.
453  * Control + Shift Inserts 42 in the text.
454  *
455  * There are some predefined actions for results.
456  * Unhandled The key/modifier is ignored and also reported
457  * unhandled.
458  * Ignored The key/modifier is ignored and it's
459  * _expected_ the inherited classes do the same.
460  * Implementation defined The key/modifier is ignored and it's expected
461  * the inherited classes will define some meaning
462  * to it.
463  */
464 
465  /**
466  * Up arrow key pressed.
467  *
468  * The behavior is implementation defined.
469  */
470  virtual void handle_key_up_arrow(SDL_Keymod modifier, bool& handled) = 0;
471 
472  /**
473  * Down arrow key pressed.
474  *
475  * The behavior is implementation defined.
476  */
477  virtual void handle_key_down_arrow(SDL_Keymod modifier, bool& handled) = 0;
478 
479  /**
480  * Clears the current line.
481  *
482  * Unmodified Clears the current line.
483  * Control Ignored.
484  * Shift Ignored.
485  * Alt Ignored.
486  */
487  virtual void handle_key_clear_line(SDL_Keymod modifier, bool& handled) = 0;
488 protected:
489  /**
490  * Left arrow key pressed.
491  *
492  * Unmodified Moves the cursor a character to the left.
493  * Control Like unmodified but a word instead of a letter
494  * at the time.
495  * Shift Selects the text while moving.
496  * Alt Ignored.
497  */
498  virtual void handle_key_left_arrow(SDL_Keymod modifier, bool& handled);
499 
500  /**
501  * Right arrow key pressed.
502  *
503  * Unmodified Moves the cursor a character to the right.
504  * Control Like unmodified but a word instead of a letter
505  * at the time.
506  * Shift Selects the text while moving.
507  * Alt Ignored.
508  */
509  virtual void handle_key_right_arrow(SDL_Keymod modifier, bool& handled);
510 
511 private:
512  /**
513  * Home key pressed.
514  *
515  * Unmodified Moves the cursor a to the beginning of the
516  * line.
517  * Control Like unmodified but to the beginning of the
518  * data.
519  * Shift Selects the text while moving.
520  * Alt Ignored.
521  */
522  virtual void handle_key_home(SDL_Keymod modifier, bool& handled);
523 
524  /**
525  * End key pressed.
526  *
527  * Unmodified Moves the cursor a to the end of the line.
528  * Control Like unmodified but to the end of the data.
529  * Shift Selects the text while moving.
530  * Alt Ignored.
531  */
532  virtual void handle_key_end(SDL_Keymod modifier, bool& handled);
533 
534  /**
535  * Backspace key pressed.
536  *
537  * Unmodified Deletes the character before the cursor,
538  * ignored if at the beginning of the data.
539  * Control Ignored.
540  * Shift Ignored.
541  * Alt Ignored.
542  */
543  virtual void handle_key_backspace(SDL_Keymod modifier, bool& handled);
544 
545  /**
546  * Delete key pressed.
547  *
548  * Unmodified If there is a selection that's deleted.
549  * Else if not at the end of the data the
550  * character after the cursor is deleted.
551  * Else the key is ignored.
552  * ignored if at the beginning of the data.
553  * Control Ignored.
554  * Shift Ignored.
555  * Alt Ignored.
556  */
557  virtual void handle_key_delete(SDL_Keymod modifier, bool& handled);
558 
559  /**
560  * Page up key.
561  *
562  * Unmodified Unhandled.
563  * Control Ignored.
564  * Shift Ignored.
565  * Alt Ignored.
566  */
567  virtual void handle_key_page_up(SDL_Keymod /*modifier*/, bool& /*handled*/)
568  {
569  }
570 
571  /**
572  * Page down key.
573  *
574  * Unmodified Unhandled.
575  * Control Ignored.
576  * Shift Ignored.
577  * Alt Ignored.
578  */
579  virtual void handle_key_page_down(SDL_Keymod /*modifier*/, bool& /*handled*/)
580  {
581  }
582 
583  /**
584  * Tab key.
585  *
586  * Unmodified Implementation defined.
587  * Control Implementation defined.
588  * Shift Implementation defined.
589  * Alt Implementation defined.
590  */
591  virtual void handle_key_tab(SDL_Keymod /*modifier*/, bool& /*handled*/)
592  {
593  }
594 
595  /**
596  * Enter key.
597  *
598  * Unmodified Handled by Window.
599  * Control Implementation defined.
600  * Shift Implementation defined.
601  * Alt Implementation defined.
602  */
603  virtual void handle_key_enter(SDL_Keymod /*modifier*/, bool& /*handled*/)
604  {
605  }
606 
607 protected:
608  virtual void handle_commit(bool& handled,
609  const std::string& unicode);
610  virtual void handle_editing(bool& handled,
611  const std::string& unicode,
612  int32_t start,
613  int32_t length);
614 
615 private:
616  /***** ***** ***** signal handlers ***** ****** *****/
617 
619  bool& handled);
620 
622  bool& handled,
623  const SDL_Keycode key,
624  SDL_Keymod modifier);
625 
627  bool& handled,
628  const std::string& unicode,
629  int32_t start,
630  int32_t len);
631 
634 
635  void signal_handler_mouse_enter(const event::ui_event event, bool& handled);
636  void signal_handler_mouse_leave(const event::ui_event event, bool& handled);
637 };
638 
639 } // namespace gui2
Text class.
Definition: text.hpp:79
unsigned get_lines_count() const
Get number of lines in the text.
Definition: text.hpp:265
pango_text & set_font_style(const FONT_STYLE font_style)
Definition: text.cpp:544
std::size_t get_length() const
Gets the length of the text in bytes.
Definition: text.hpp:273
int get_line_num_from_offset(const unsigned offset)
Given a byte index, find out at which line the corresponding character is located.
Definition: text.cpp:1129
point get_column_line(const point &position) const
Gets the column of line of the character at the position.
Definition: text.cpp:286
PangoLayoutLine * get_line(int index)
Get a specific line from the pango layout.
Definition: text.cpp:1124
pango_text & set_family_class(font::family_class fclass)
Definition: text.cpp:522
std::vector< std::string > get_lines() const
Retrieves a list of strings with contents for each rendered line.
Definition: text.cpp:1098
pango_text & set_ellipse_mode(const PangoEllipsizeMode ellipse_mode)
Definition: text.cpp:615
void add_attribute_bg_color(const unsigned start_offset, const unsigned end_offset, const color_t &color)
Mark a specific portion of text for highlighting.
Definition: text.cpp:458
point get_cursor_position(const unsigned column, const unsigned line=0) const
Gets the location for the cursor, in drawing coordinates.
Definition: text.cpp:185
pango_text & set_font_size(unsigned font_size)
Definition: text.cpp:532
point get_cursor_pos_from_index(const unsigned offset) const
Gets the location for the cursor, in drawing coordinates.
Definition: text.cpp:225
pango_text & set_maximum_height(int height, bool multiline)
Definition: text.cpp:590
pango_text & set_maximum_width(int width)
Definition: text.cpp:563
const std::string & text() const
Definition: text.hpp:291
virtual void update_canvas()
Updates the canvas(ses).
Abstract base class for text items.
virtual void handle_key_backspace(SDL_Keymod modifier, bool &handled)
Backspace key pressed.
std::size_t get_length() const
Wrapper function, returns length of the text in pango column offsets.
virtual void handle_commit(bool &handled, const std::string &unicode)
virtual bool get_active() const override
See styled_widget::get_active.
virtual unsigned get_state() const override
See styled_widget::get_state.
void set_font_size(const unsigned font_size)
void update_mouse_cursor(bool enable)
point get_column_line(const point &position) const
virtual void goto_start_of_line(const bool select=false)=0
Moves the cursor to the beginning of the line.
virtual void handle_key_delete(SDL_Keymod modifier, bool &handled)
Delete key pressed.
virtual void insert_char(const std::string &unicode)
Inserts a character at the cursor.
virtual void handle_editing(bool &handled, const std::string &unicode, int32_t start, int32_t length)
SDL_TEXTEDITING handler.
void set_state(const state_t state)
std::chrono::milliseconds cursor_blink_rate_
virtual void copy_selection()
Copies the current selection.
void signal_handler_sdl_text_input(const event::ui_event event, bool &handled, const std::string &unicode, int32_t start, int32_t len)
virtual void handle_key_left_arrow(SDL_Keymod modifier, bool &handled)
Left arrow key pressed.
void on_modified(const Func &f)
Registers a NOTIFY_MODIFIED handler.
virtual void toggle_cursor_timer(bool enable)
point get_cursor_pos_from_index(const unsigned offset) const
Wrapper function, return the cursor position given the byte index.
text_box_base(const implementation::builder_styled_widget &builder, const std::string &control_type)
std::string get_value() const
void set_editable(bool editable)
Set or unset whether text can be edited or not Text can only be copied and scrolled through when edit...
void set_highlight_area(const unsigned start_offset, const unsigned end_offset, const color_t &color)
Wrapper function, sets the area between column start and end offset to be highlighted in a specific c...
state_t state_
Current state of the widget.
virtual void goto_end_of_line(const bool select=false)=0
Moves the cursor to the end of the line.
std::size_t get_composition_start() const
void signal_handler_mouse_leave(const event::ui_event event, bool &handled)
void set_selection(std::size_t start, int length)
Sets or clears the text selection.
std::size_t selection_start_
Start of the selected text.
size_t get_composition_length() const
Get length of composition text by IME.
std::string plain_text()
virtual void handle_key_enter(SDL_Keymod, bool &)
Enter key.
int selection_length_
Length of the selected text.
unsigned short cursor_alpha_
std::size_t cursor_timer_
virtual void handle_key_up_arrow(SDL_Keymod modifier, bool &handled)=0
Every key can have several behaviors.
const std::string & text() const
point get_cursor_position(const unsigned column, const unsigned line=0) const
void set_font_style(const font::pango_text::FONT_STYLE font_style)
unsigned get_lines_count() const
Wrapper function, return number of lines.
void signal_handler_mouse_enter(const event::ui_event event, bool &handled)
virtual void handle_key_tab(SDL_Keymod, bool &)
Tab key.
std::string text_cached_
Cached version of the text without any pending IME modifications.
void set_font_family(font::family_class fclass)
virtual void set_value(const std::string &text)
The set_value is virtual for the password_box class.
virtual void paste_selection()
Pastes the current selection.
state_t
Note the order of the states must be the same as defined in settings.hpp.
font::pango_text text_
The text entered in the widget.
void signal_handler_lose_keyboard_focus(const event::ui_event event)
void signal_handler_sdl_key_down(const event::ui_event event, bool &handled, const SDL_Keycode key, SDL_Keymod modifier)
virtual void handle_key_right_arrow(SDL_Keymod modifier, bool &handled)
Right arrow key pressed.
std::size_t get_selection_length() const
virtual void handle_key_clear_line(SDL_Keymod modifier, bool &handled)=0
Clears the current line.
PangoLayoutLine * get_line(int index)
Wrapper function, returns the line corresponding to index.
void set_maximum_height(const int height, const bool multiline)
font::family_class font_family_
font family
void set_ellipse_mode(const PangoEllipsizeMode ellipse_mode)
font::family_class get_font_family()
void set_selection_start(const std::size_t selection_start)
virtual void set_cursor(const std::size_t offset, const bool select)
Moves the cursor at the wanted position.
std::vector< std::string > get_lines()
Wrapper function, returns a vector with the lines.
void set_maximum_width(const int width)
virtual void handle_key_page_up(SDL_Keymod, bool &)
Page up key.
virtual void handle_key_home(SDL_Keymod modifier, bool &handled)
Home key pressed.
bool is_editable() const
Check whether text can be edited or not.
virtual void handle_key_down_arrow(SDL_Keymod modifier, bool &handled)=0
Down arrow key pressed.
void signal_handler_receive_keyboard_focus(const event::ui_event event)
virtual void goto_end_of_data(const bool select=false)
Moves the cursor to the end of all text.
void signal_handler_middle_button_click(const event::ui_event event, bool &handled)
virtual void handle_key_end(SDL_Keymod modifier, bool &handled)
End key pressed.
virtual void handle_key_page_down(SDL_Keymod, bool &)
Page down key.
std::size_t get_selection_start() const
virtual void set_active(const bool active) override
See styled_widget::set_active.
void set_selection_length(const int selection_length)
bool is_composing() const
bool editable_
If this text_box_base is editable.
virtual void goto_start_of_data(const bool select=false)
Moves the cursor to the beginning of the data.
virtual void cursor_timer_callback()
Implements blinking cursor functionality.
virtual void reset_cursor_state()
void set_maximum_length(const std::size_t maximum_length)
int get_line_number(const unsigned offset)
Wrapper function, return the line number given the byte index.
virtual void delete_selection()=0
Deletes the current selection.
virtual void delete_char(const bool before_cursor)=0
Deletes the character.
void select_all()
Selects all text.
Base class for all widgets.
Definition: widget.hpp:55
int w
void line(int from_x, int from_y, int to_x, int to_y)
Draw a line.
Definition: draw.cpp:187
EXIT_STATUS start(bool clear_id, const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
family_class
Font classes for get_font_families().
ui_event
The event sent to the dispatcher.
Definition: handler.hpp:115
Generic file dialog.
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
Definition: unicode.cpp:85
std::size_t index(std::string_view str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:70
The basic class for representing 8-bit RGB or RGBA colour values.
Definition: color.hpp:59
Holds a 2D point.
Definition: point.hpp:25
#define f