|
HikoGUI
A low latency retained GUI
|
Public Types | |
| using | callback_token = notifier<void()>::callback_token |
| using | awaiter_type = notifier<void()>::awaiter_type |
Public Member Functions | |
| widget (widget *parent) noexcept | |
| widget (widget const &)=delete | |
| widget (widget &&)=delete | |
| widget & | operator= (widget &&)=delete |
| widget & | operator= (widget const &)=delete |
| virtual generator< widget const & > | children (bool include_invisible) const noexcept |
| Get a list of child widgets. | |
| generator< widget & > | children (bool include_invisible) noexcept |
| virtual hitbox | hitbox_test (point2 position) const noexcept |
| Find the widget that is under the mouse cursor. | |
| virtual hitbox | hitbox_test_from_parent (point2 position) const noexcept |
| Call hitbox_test from a parent widget. | |
| virtual hitbox | hitbox_test_from_parent (point2 position, hitbox sibling_hitbox) const noexcept |
| Call hitbox_test from a parent widget. | |
| virtual bool | accepts_keyboard_focus (keyboard_focus_group group) const noexcept |
| Check if the widget will accept keyboard focus. | |
| void | reset_layout (gfx_surface *new_surface, float new_scale) noexcept |
| Reset the layout. | |
| virtual void | layout () noexcept |
| virtual void | draw (widget_draw_context &context) noexcept |
| Draw the widget. | |
| virtual sub_theme_selector_type | sub_theme_selector () const noexcept |
| virtual bool | process_event (gui_event const &event) const noexcept |
| virtual void | request_redraw () const noexcept |
| Request the widget to be redrawn on the next frame. | |
| virtual bool | handle_event (gui_event const &event) noexcept |
| Handle command. | |
| virtual bool | handle_event_recursive (gui_event const &event, std::vector< widget_id > const &reject_list=std::vector< widget_id >{}) noexcept |
| Handle command recursive. | |
| virtual widget_id | find_next_widget (widget_id current_keyboard_widget, keyboard_focus_group group, keyboard_focus_direction direction) const noexcept |
| Find the next widget that handles keyboard focus. | |
| widget_id | find_first_widget (keyboard_focus_group group) const noexcept |
| widget_id | find_last_widget (keyboard_focus_group group) const noexcept |
| bool | is_first (keyboard_focus_group group) const noexcept |
| bool | is_last (keyboard_focus_group group) const noexcept |
| virtual void | scroll_to_show (hi::aarectangle rectangle) noexcept |
| Scroll to show the given rectangle on the window. | |
| std::vector< widget_id > | parent_chain () const noexcept |
| Get a list of parents of a given widget. | |
| virtual bool | is_tab_button () const noexcept |
| Check if this widget is a tab-button. | |
| template<forward_of< void()> Callback> | |
| callback_token | subscribe (Callback &&callback, callback_flags flags=callback_flags::synchronous) const noexcept |
| awaiter_type | operator co_await () const noexcept |
Data Fields | |
| widget_id | id = {} |
| The numeric identifier of a widget. | |
| widget * | parent = nullptr |
| Pointer to the parent widget. | |
| gfx_surface * | surface = nullptr |
| The surface this widget is drawn on. | |
| observer< widget_mode > | mode = widget_mode::enabled |
| The widget mode. | |
| observer< bool > | hover = false |
| Mouse cursor is hovering over the widget. | |
| observer< bool > | clicked = false |
| The widget is being clicked by the mouse. | |
| observer< bool > | focus = false |
| The widget has keyboard focus. | |
| observer< widget_state > | state = widget_state::off |
| The state of the widget. | |
| size_t | semantic_layer = 0_uz |
| The draw layer of the widget. | |
| grid_cell | cell |
|
inlinevirtualnoexcept |
Check if the widget will accept keyboard focus.
Reimplemented in hi::v1::scroll_bar_widget< Axis, Name >.
|
inlinevirtualnoexcept |
Get a list of child widgets.
Reimplemented in hi::v1::spacer_widget.
|
inlinevirtualnoexcept |
Draw the widget.
This function is called by the window (optionally) on every frame. It should recursively call this function on every visible child. This function is only called when updateLayout() has returned true.
The overriding function should call the base class's draw(), the place where the call this function will determine the order of the vertices into each buffer. This is important when needing to do the painters algorithm for alpha-compositing. However the pipelines are always drawn in the same order.
| context | The context to where the widget will draw. |
Reimplemented in hi::v1::scroll_bar_widget< Axis, Name >, and hi::v1::spacer_widget.
|
inlinevirtualnoexcept |
Find the next widget that handles keyboard focus.
This recursively looks for the current keyboard widget, then returns the next (or previous) widget that returns true from accepts_keyboard_focus().
| current_keyboard_widget | The widget that currently has focus; or nullptr to get the first widget that accepts focus. |
| group | The group to which the widget must belong. |
| direction | The direction in which to walk the widget tree. |
| current_keyboard_widget | When current_keyboard_widget was found but no next widget that accepts keyboard focus was found. |
| nullptr | When current_keyboard_widget is not found in this widget. |
|
inlinevirtualnoexcept |
Handle command.
If a widget does not fully handle a command it should pass the command to the super class' handle_event().
Reimplemented in hi::v1::scroll_bar_widget< Axis, Name >.
|
inlinevirtualnoexcept |
Handle command recursive.
Handle a command and pass it to each child.
| event | The command to handle by this widget. |
| reject_list | The widgets that should ignore this command |
|
inlinevirtualnoexcept |
Find the widget that is under the mouse cursor.
This function will recursively test with visual child widgets, when widgets overlap on the screen the hitbox object with the highest elevation is returned.
| position | The coordinate of the mouse local to the widget. |
Reimplemented in hi::v1::scroll_bar_widget< Axis, Name >, and hi::v1::spacer_widget.
|
inlinevirtualnoexcept |
Call hitbox_test from a parent widget.
This function will transform the position from parent coordinates to local coordinates.
| position | The coordinate of the mouse local to the parent widget. |
|
inlinevirtualnoexcept |
Call hitbox_test from a parent widget.
This function will transform the position from parent coordinates to local coordinates.
| position | The coordinate of the mouse local to the parent widget. |
| sibling_hitbox | The hitbox of a sibling to combine with the hitbox of this widget. |
|
inlinevirtualnoexcept |
Check if this widget is a tab-button.
Used by the toolbar to determine if it will draw a focus line underneath the toolbar.
|
inlinenoexcept |
Get a list of parents of a given widget.
The chain includes the given widget.
|
inlinevirtualnoexcept |
Request the widget to be redrawn on the next frame.
Reimplemented in hi::v1::toolbar_tab_button_widget< Name >.
|
inlinenoexcept |
Reset the layout.
| new_scale | The scaling factor from this point forward. |
|
inlinevirtualnoexcept |
Scroll to show the given rectangle on the window.
This will call parents, until all parents have scrolled the rectangle to be shown on the window.
| rectangle | The rectangle in window coordinates. |
| observer<bool> hi::v1::widget::clicked = false |
The widget is being clicked by the mouse.
| observer<bool> hi::v1::widget::focus = false |
The widget has keyboard focus.
| observer<bool> hi::v1::widget::hover = false |
Mouse cursor is hovering over the widget.
| widget_id hi::v1::widget::id = {} |
The numeric identifier of a widget.
| observer<widget_mode> hi::v1::widget::mode = widget_mode::enabled |
The widget mode.
The current visibility and interactivity of a widget.
| widget* hi::v1::widget::parent = nullptr |
Pointer to the parent widget.
May be a nullptr only when this is the top level widget.
| size_t hi::v1::widget::semantic_layer = 0_uz |
The draw layer of the widget.
The semantic layer is used mostly by the draw() function for selecting colors from the theme, to denote nesting widgets inside other widgets.
Semantic layers start at 0 for the window-widget and for any pop-up widgets.
The semantic layer is increased by one, whenever a user of the user-interface would understand the next layer to begin.
In most cases it would mean that a container widget that does not draw itself will not increase the semantic_layer number.
| observer<widget_state> hi::v1::widget::state = widget_state::off |
The state of the widget.
| gfx_surface* hi::v1::widget::surface = nullptr |
The surface this widget is drawn on.