The Battle for Wesnoth  1.19.4+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  /** Set the text_changed callback. */
159  std::function<void(text_box_base* textbox, const std::string text)> cb)
160  {
162  }
163 
164  /**
165  * Sets or clears the text selection.
166  *
167  * Setting the selection range will re-position the cursor depending on the
168  * selection direction, specified by the length's sign. Selecting beyond the
169  * start or end of the text is safe; the final selection will be limited
170  * accordingly.
171  *
172  * @note The range extents are measured in Unicode characters, not bytes.
173  * Using byte offsets may produce unexpected results depending on the
174  * text contents.
175  *
176  * @param start Start offset, in characters.
177  * @param length Selection length, in characters. If zero, the
178  * current selection is canceled. If negative, the
179  * selection extends towards the start of the text
180  * and the cursor will be re-positioned in that
181  * direction as well; otherwise the selection and
182  * cursor extend towards the end.
183  */
184  void set_selection(std::size_t start, int length);
185 
186  /**
187  * Set or unset whether text can be edited or not
188  * Text can only be copied and scrolled through when editable is false.
189  */
190  void set_editable(bool editable)
191  {
192  editable_ = editable;
193  update_canvas();
194  }
195 
196  /**
197  * Check whether text can be edited or not
198  */
199  bool is_editable()
200  {
201  return editable_;
202  }
203 
204 protected:
205  /** Get length of composition text by IME **/
206  size_t get_composition_length() const;
207 
208  /**
209  * Moves the cursor to the end of the line.
210  *
211  * @param select Select the text from the original cursor
212  * position till the end of the line?
213  */
214  virtual void goto_end_of_line(const bool select = false) = 0;
215 
216  /**
217  * Moves the cursor to the end of all text.
218  *
219  * For a single line text this is the same as goto_end_of_line().
220  *
221  * @param select Select the text from the original cursor
222  * position till the end of the data?
223  */
224  virtual void goto_end_of_data(const bool select = false)
225  {
226  set_cursor(text_.get_length(), select);
227  }
228 
229  /**
230  * Moves the cursor to the beginning of the line
231  *
232  * @param select Select the text from the original cursor
233  * position till the beginning of the line?
234  */
235  virtual void goto_start_of_line(const bool select = false) = 0;
236 
237  /**
238  * Moves the cursor to the beginning of the data.
239  *
240  * @param select Select the text from the original cursor
241  * position till the beginning of the data?
242  */
243  virtual void goto_start_of_data(const bool select = false)
244  {
245  set_cursor(0, select);
246  }
247 
248  /** Selects all text. */
249  void select_all()
250  {
251  selection_start_ = 0;
252  goto_end_of_data(true);
253  }
254 
255  /**
256  * Moves the cursor at the wanted position.
257  *
258  * @param offset The wanted new cursor position.
259  * @param select Select the text from the original cursor
260  * position till the new position?
261  */
262  virtual void set_cursor(const std::size_t offset, const bool select);
263 
264  /**
265  * Inserts a character at the cursor.
266  *
267  * This function is preferred over set_text since it's optimized for
268  * updating the internal bookkeeping.
269  *
270  * @param unicode The unicode value of the character to insert.
271  */
272  virtual void insert_char(const std::string& unicode);
273 
274  /**
275  * Deletes the character.
276  *
277  * @param before_cursor If true it deletes the character before the
278  * cursor (backspace) else the character after
279  * the cursor (delete).
280  */
281  virtual void delete_char(const bool before_cursor) = 0;
282 
283  /** Deletes the current selection. */
284  virtual void delete_selection() = 0;
285 
286  /** Copies the current selection. */
287  virtual void copy_selection();
288 
289  /** Pastes the current selection. */
290  virtual void paste_selection();
291 
292  /***** ***** ***** ***** expose some functions ***** ***** ***** *****/
293 
294  point get_cursor_position(const unsigned column,
295  const unsigned line = 0) const
296  {
297  return text_.get_cursor_position(column, line);
298  }
299 
300  point get_column_line(const point& position) const
301  {
302  return text_.get_column_line(position);
303  }
304 
306  {
307  return font_family_;
308  }
309 
311  {
312  font_family_ = fclass;
314  }
315 
316  void set_font_size(const unsigned font_size)
317  {
318  text_.set_font_size(font_size);
319  }
320 
322  {
323  text_.set_font_style(font_style);
324  }
325 
326  void set_maximum_width(const int width)
327  {
328  text_.set_maximum_width(width);
329  }
330 
331  void set_maximum_height(const int height, const bool multiline)
332  {
333  text_.set_maximum_height(height, multiline);
334  }
335 
336  void set_ellipse_mode(const PangoEllipsizeMode ellipse_mode)
337  {
338  text_.set_ellipse_mode(ellipse_mode);
339  }
340 
341  /***** ***** ***** setters / getters for members ***** ****** *****/
342 
343  std::size_t get_selection_start() const
344  {
345  return selection_start_;
346  }
347  void set_selection_start(const std::size_t selection_start);
348 
349  std::size_t get_selection_length() const
350  {
351  return selection_length_;
352  }
353  void set_selection_length(const int selection_length);
354 
355  std::size_t get_composition_start() const
356  {
357  return ime_start_point_;
358  }
359 
360 public:
361  bool is_composing() const
362  {
363  return ime_composing_;
364  }
365 
366  void interrupt_composition();
367 
368  /** Note the order of the states must be the same as defined in
369  * settings.hpp. */
370  enum state_t {
375  };
376 
377 private:
378  void set_state(const state_t state);
379 
380  virtual void toggle_cursor_timer(bool enable);
381 
382  /** Implements blinking cursor functionality. */
383  virtual void cursor_timer_callback();
384 
385  virtual void reset_cursor_state();
386 
387  void update_mouse_cursor(bool enable);
388 
389  /**
390  * Current state of the widget.
391  *
392  * The state of the widget determines what to render and how the widget
393  * reacts to certain 'events'.
394  */
396 
397  /** The text entered in the widget. */
399 
400  /** font family */
402 
403  /** Cached version of the text without any pending IME modifications. */
404  std::string text_cached_;
405 
406  /** Start of the selected text. */
407  std::size_t selection_start_;
408 
409  /**
410  * Length of the selected text.
411  *
412  * * positive selection_len_ means selection to the right.
413  * * negative selection_len_ means selection to the left.
414  * * selection_len_ == 0 means no selection.
415  */
417 
418  /** If this text_box_base is editable */
419  bool editable_;
420 
421  // Values to support input method editors
424 
425  std::size_t cursor_timer_;
426 
427  unsigned short cursor_alpha_;
428  unsigned short cursor_blink_rate_ms_;
429 
430  /****** handling of special keys first the pure virtuals *****/
431 
432  /**
433  * Every key can have several behaviors.
434  *
435  * Unmodified No modifier is pressed.
436  * Control The control key is pressed.
437  * Shift The shift key is pressed.
438  * Alt The alt key is pressed.
439  *
440  * If modifiers together do something else as the sum of the modifiers
441  * it's listed separately eg.
442  *
443  * Control Moves 10 steps at the time.
444  * Shift Selects the text.
445  * Control + Shift Inserts 42 in the text.
446  *
447  * There are some predefined actions for results.
448  * Unhandled The key/modifier is ignored and also reported
449  * unhandled.
450  * Ignored The key/modifier is ignored and it's
451  * _expected_ the inherited classes do the same.
452  * Implementation defined The key/modifier is ignored and it's expected
453  * the inherited classes will define some meaning
454  * to it.
455  */
456 
457  /**
458  * Up arrow key pressed.
459  *
460  * The behavior is implementation defined.
461  */
462  virtual void handle_key_up_arrow(SDL_Keymod modifier, bool& handled) = 0;
463 
464  /**
465  * Down arrow key pressed.
466  *
467  * The behavior is implementation defined.
468  */
469  virtual void handle_key_down_arrow(SDL_Keymod modifier, bool& handled) = 0;
470 
471  /**
472  * Clears the current line.
473  *
474  * Unmodified Clears the current line.
475  * Control Ignored.
476  * Shift Ignored.
477  * Alt Ignored.
478  */
479  virtual void handle_key_clear_line(SDL_Keymod modifier, bool& handled) = 0;
480 protected:
481  /**
482  * Left arrow key pressed.
483  *
484  * Unmodified Moves the cursor a character to the left.
485  * Control Like unmodified but a word instead of a letter
486  * at the time.
487  * Shift Selects the text while moving.
488  * Alt Ignored.
489  */
490  virtual void handle_key_left_arrow(SDL_Keymod modifier, bool& handled);
491 
492  /**
493  * Right arrow key pressed.
494  *
495  * Unmodified Moves the cursor a character to the right.
496  * Control Like unmodified but a word instead of a letter
497  * at the time.
498  * Shift Selects the text while moving.
499  * Alt Ignored.
500  */
501  virtual void handle_key_right_arrow(SDL_Keymod modifier, bool& handled);
502 
503 private:
504  /**
505  * Home key pressed.
506  *
507  * Unmodified Moves the cursor a to the beginning of the
508  * line.
509  * Control Like unmodified but to the beginning of the
510  * data.
511  * Shift Selects the text while moving.
512  * Alt Ignored.
513  */
514  virtual void handle_key_home(SDL_Keymod modifier, bool& handled);
515 
516  /**
517  * End key pressed.
518  *
519  * Unmodified Moves the cursor a to the end of the line.
520  * Control Like unmodified but to the end of the data.
521  * Shift Selects the text while moving.
522  * Alt Ignored.
523  */
524  virtual void handle_key_end(SDL_Keymod modifier, bool& handled);
525 
526  /**
527  * Backspace key pressed.
528  *
529  * Unmodified Deletes the character before the cursor,
530  * ignored if at the beginning of the data.
531  * Control Ignored.
532  * Shift Ignored.
533  * Alt Ignored.
534  */
535  virtual void handle_key_backspace(SDL_Keymod modifier, bool& handled);
536 
537  /**
538  * Delete key pressed.
539  *
540  * Unmodified If there is a selection that's deleted.
541  * Else if not at the end of the data the
542  * character after the cursor is deleted.
543  * Else the key is ignored.
544  * ignored if at the beginning of the data.
545  * Control Ignored.
546  * Shift Ignored.
547  * Alt Ignored.
548  */
549  virtual void handle_key_delete(SDL_Keymod modifier, bool& handled);
550 
551  /**
552  * Page up key.
553  *
554  * Unmodified Unhandled.
555  * Control Ignored.
556  * Shift Ignored.
557  * Alt Ignored.
558  */
559  virtual void handle_key_page_up(SDL_Keymod /*modifier*/, bool& /*handled*/)
560  {
561  }
562 
563  /**
564  * Page down key.
565  *
566  * Unmodified Unhandled.
567  * Control Ignored.
568  * Shift Ignored.
569  * Alt Ignored.
570  */
571  virtual void handle_key_page_down(SDL_Keymod /*modifier*/, bool& /*handled*/)
572  {
573  }
574 
575  /**
576  * Tab key.
577  *
578  * Unmodified Implementation defined.
579  * Control Implementation defined.
580  * Shift Implementation defined.
581  * Alt Implementation defined.
582  */
583  virtual void handle_key_tab(SDL_Keymod /*modifier*/, bool& /*handled*/)
584  {
585  }
586 
587  /**
588  * Enter key.
589  *
590  * Unmodified Handled by Window.
591  * Control Implementation defined.
592  * Shift Implementation defined.
593  * Alt Implementation defined.
594  */
595  virtual void handle_key_enter(SDL_Keymod /*modifier*/, bool& /*handled*/)
596  {
597  }
598 
599 protected:
600  virtual void handle_commit(bool& handled,
601  const std::string& unicode);
602  virtual void handle_editing(bool& handled,
603  const std::string& unicode,
604  int32_t start,
605  int32_t length);
606 
607 private:
608  /**
609  * Text changed callback.
610  *
611  * This callback is called in key_press after the key_press event has been
612  * handled by the styled_widget. The parameters to the function are:
613  * - The widget invoking the callback
614  * - The new text of the textbox.
615  */
616  std::function<void(text_box_base* textbox, const std::string text)>
618 
619  /***** ***** ***** signal handlers ***** ****** *****/
620 
622  bool& handled);
623 
625  bool& handled,
626  const SDL_Keycode key,
627  SDL_Keymod modifier);
628 
630  bool& handled,
631  const std::string& unicode,
632  int32_t start,
633  int32_t len);
634 
637 
638  void signal_handler_mouse_enter(const event::ui_event event, bool& handled);
639  void signal_handler_mouse_leave(const event::ui_event event, bool& handled);
640 };
641 
642 } // 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.
unsigned short cursor_blink_rate_ms_
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)
std::function< void(text_box_base *textbox, const std::string text)> text_changed_callback_
Text changed callback.
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)
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.
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.
void set_text_changed_callback(std::function< void(text_box_base *textbox, const std::string text)> cb)
Set the text_changed callback.
virtual void handle_key_down_arrow(SDL_Keymod modifier, bool &handled)=0
Down arrow key pressed.
bool is_editable()
Check whether text can be edited or not.
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.
void line(int from_x, int from_y, int to_x, int to_y)
Draw a line.
Definition: draw.cpp:180
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 index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:70
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
Definition: unicode.cpp:85
The basic class for representing 8-bit RGB or RGBA colour values.
Definition: color.hpp:59
Holds a 2D point.
Definition: point.hpp:25