70 observer<alignment>
alignment = hi::alignment::middle_center();
74 observer<semantic_text_style>
text_style = semantic_text_style::label;
115 void draw(draw_context const& context) noexcept override;
116 bool handle_event(
gui_event const& event) noexcept override;
117 hitbox hitbox_test(point3 position) const noexcept override;
118 [[nodiscard]]
bool accepts_keyboard_focus(keyboard_focus_group group) const noexcept override;
121 enum class add_type { append, insert, dead };
125 text_selection selection;
128 enum class cursor_state_type {
off,
on, busy, none };
130 gstring _cached_text;
131 text_shaper _shaped_text;
134 delegate_type::callback_token _delegate_cbt;
136 decltype(
text_style)::callback_token _text_style_cbt;
138 text_selection _selection;
140 scoped_task<> _blink_cursor;
142 observer<cursor_state_type> _cursor_state = cursor_state_type::none;
143 decltype(_cursor_state)::callback_token _cursor_state_cbt;
147 bool _request_scroll =
false;
155 gui_event _last_drag_mouse_event = {};
159 utc_nanoseconds _last_drag_mouse_event_next_repeat = {};
165 bool _overwrite_mode =
false;
172 grapheme _has_dead_character =
nullptr;
174 undo_stack<undo_type> _undo_stack = {1000};
176 void set_attributes() noexcept {}
177 void set_attributes(text_widget_attribute
auto&& first, text_widget_attribute
auto&&...rest)
noexcept
179 if constexpr (forward_of<
decltype(first), observer<hi::alignment>>) {
181 }
else if constexpr (forward_of<
decltype(first), observer<hi::semantic_text_style>>) {
184 hi_static_no_default();
194 void update_shaped_text() noexcept;
198 void scroll_to_show_selection() noexcept;
200 void request_scroll() noexcept;
211 void reset_state(
char const *states) noexcept;
213 [[nodiscard]] gstring_view selected_text() const noexcept;
214 void undo_push() noexcept;
215 void undo() noexcept;
216 void redo() noexcept;
218 scoped_task<> blink_cursor() noexcept;
222 void fix_cursor_position() noexcept;
224 void replace_selection(gstring const& replacement) noexcept;
232 void delete_dead_character() noexcept;
233 void delete_character_next() noexcept;
234 void delete_character_prev() noexcept;
235 void delete_word_next() noexcept;
236 void delete_word_prev() noexcept;
std::shared_ptr< text_delegate > make_default_text_delegate(auto &&value) noexcept
Create a shared pointer to a default text delegate.
Definition text_delegate.hpp:224
text_widget(gui_window &window, widget *parent, different_from< std::shared_ptr< delegate_type > > auto &&text, text_widget_attribute auto &&...attributes) noexcept
Construct a text widget.
Definition text_widget.hpp:103
widget_layout const & layout() const noexcept
Get the current layout for this widget.
Definition widget.hpp:198