|
HikoGUI
A low latency retained GUI
|
Public Types | |
| using | super = abstract_container_widget |
| using | value_type = T |
| using | option_list_type = std::vector<std::pair<value_type, label>> |
Public Types inherited from tt::abstract_container_widget | |
| using | super = widget |
Public Member Functions | |
| template<typename Value = value_type, typename OptionList = option_list_type, typename UnknownLabel = label> | |
| selection_widget (gui_window &window, std::shared_ptr< abstract_container_widget > parent, Value &&value=value_type{}, OptionList &&option_list=option_list_type{}, UnknownLabel &&unknown_label=label{l10n("<unknown>")}) noexcept | |
| void | init () noexcept override |
| Should be called right after allocating and constructing a widget. | |
| bool | update_constraints (hires_utc_clock::time_point display_time_point, bool need_reconstrain) noexcept override |
| Update the constraints of the widget. | |
| void | update_layout (hires_utc_clock::time_point display_time_point, bool need_layout) noexcept override |
| Update the internal layout of the widget. | |
| void | draw (draw_context context, hires_utc_clock::time_point display_time_point) noexcept override |
| Draw the widget. | |
| bool | handle_event (mouse_event const &event) noexcept override |
| bool | handle_event (command command) noexcept override |
| Handle command. | |
| hit_box | hitbox_test (f32x4 window_position) const noexcept override |
| Find the widget that is under the mouse cursor. | |
| bool | accepts_keyboard_focus (keyboard_focus_group group) const noexcept override |
| Check if the widget will accept keyboard focus. | |
| std::shared_ptr< widget > | find_next_widget (std::shared_ptr< widget > const ¤t_widget, keyboard_focus_group group, keyboard_focus_direction direction) const noexcept |
| Find the next widget that handles keyboard focus. | |
| template<typename T , typename... Args> | |
| std::shared_ptr< T > | make_widget (Args &&...args) |
Public Member Functions inherited from tt::abstract_container_widget | |
| abstract_container_widget (gui_window &window, std::shared_ptr< abstract_container_widget > parent) noexcept | |
| void | clear () noexcept |
| Remove and deallocate all child widgets. | |
| std::shared_ptr< widget > | add_widget (std::shared_ptr< widget > widget) noexcept |
| Add a widget directly to this widget. | |
| widget & | front () noexcept |
| widget const & | front () const noexcept |
| widget & | back () noexcept |
| widget const & | back () const noexcept |
| std::shared_ptr< abstract_container_widget const > | shared_from_this () const noexcept |
| std::shared_ptr< abstract_container_widget > | shared_from_this () noexcept |
| template<typename T , typename... Args> | |
| std::shared_ptr< T > | make_widget (Args &&...args) |
| Add a widget directly to this widget. | |
| virtual bool | is_toolbar () const noexcept |
| bool | handle_command_recursive (command command, std::vector< std::shared_ptr< widget > > const &reject_list) noexcept override |
| Handle command recursive. | |
| std::shared_ptr< widget const > | find_first_widget (keyboard_focus_group group) const noexcept |
| std::shared_ptr< widget const > | find_last_widget (keyboard_focus_group group) const noexcept |
Public Member Functions inherited from tt::widget | |
| widget (gui_window &window, std::shared_ptr< abstract_container_widget > parent) noexcept | |
| widget (const widget &)=delete | |
| widget & | operator= (const widget &)=delete |
| widget (widget &&)=delete | |
| widget & | operator= (widget &&)=delete |
| float | margin () const noexcept |
| Get the margin around the Widget. | |
| float | draw_layer () const noexcept |
| The first drawing layer of the widget. | |
| int | logical_layer () const noexcept |
| The logical layer of the widget. | |
| int | semantic_layer () const noexcept |
| The semantic layer of the widget. | |
| ranged_int< 3 > | width_resistance () const noexcept |
| Get the resistance in width. | |
| ranged_int< 3 > | height_resistance () const noexcept |
| Get the resistance in height. | |
| interval_vec2 | preferred_size () const noexcept |
| Get the size-range of the widget. | |
| relative_base_line | preferred_base_line () const noexcept |
| Get the relative_base_line of the widget. | |
| void | set_layout_parameters (aarect const &window_rectangle, aarect const &window_clipping_rectangle, float window_base_line=std::numeric_limits< float >::infinity()) noexcept |
| Set the location and size of the widget inside the window. | |
| aarect | window_rectangle () const noexcept |
| Get the rectangle in window coordinates. | |
| virtual aarect | window_clipping_rectangle () const noexcept |
| Get the clipping-rectangle in window coordinates. | |
| float | window_base_line () const noexcept |
| Get the base-line distance from the bottom of the window. | |
| aarect | rectangle () const noexcept |
| Get the rectangle in local coordinates. | |
| float | base_line () const noexcept |
| Get the base-line in local coordinates. | |
| gui_device * | device () const noexcept |
| virtual draw_context | make_draw_context (draw_context context) const noexcept |
| Make a draw context for this widget. | |
| virtual bool | handle_event (std::vector< command > const &commands) noexcept |
| virtual bool | handle_event (keyboard_event const &event) noexcept |
| Handle keyboard event. | |
| std::shared_ptr< abstract_container_widget const > | shared_parent () const noexcept |
| Get a shared_ptr to the parent. | |
| std::shared_ptr< abstract_container_widget > | shared_parent () noexcept |
| Get a shared_ptr to the parent. | |
| abstract_container_widget const & | parent () const noexcept |
| Get a reference to the parent. | |
| abstract_container_widget & | parent () noexcept |
| Get a reference to the parent. | |
| bool | is_first (keyboard_focus_group group) const noexcept |
| Is this widget the first widget in the parent container. | |
| bool | is_last (keyboard_focus_group group) const noexcept |
| Is this widget the last widget in the parent container. | |
Public Member Functions inherited from std::enable_shared_from_this< widget > | |
| T | enable_shared_from_this (T... args) |
| T | operator= (T... args) |
| T | shared_from_this (T... args) |
| T | ~enable_shared_from_this (T... args) |
Data Fields | |
| observable< label > | unknown_label |
| observable< value_type > | value |
| observable< option_list_type > | option_list |
Data Fields inherited from tt::widget | |
| gui_window & | window |
| Convenient reference to the Window. | |
| observable< bool > | enabled = true |
| The widget is enabled. | |
Additional Inherited Members | |
Static Public Member Functions inherited from tt::widget | |
| static std::vector< std::shared_ptr< widget > > | parent_chain (std::shared_ptr< tt::widget > const &child_widget) noexcept |
| Get a list of parents of a given widget. | |
|
inlineoverridevirtualnoexcept |
Check if the widget will accept keyboard focus.
mutex must be locked by current thread. Reimplemented from tt::widget.
|
inlineoverridevirtualnoexcept |
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.
mutex must be locked by current thread. | context | The context to where the widget will draw. |
| display_time_point | The time point when the widget will be shown on the screen. |
Reimplemented from tt::abstract_container_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 empty 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. |
| currentKeyboardWidget | when currentKeyboardWidget was found but no next widget was found. |
| empty | when currentKeyboardWidget is not found in this Widget. |
Reimplemented from tt::abstract_container_widget.
|
inlineoverridevirtualnoexcept |
Handle command.
If a widget does not fully handle a command it should pass the command to the super class' handle_event().
Reimplemented from tt::widget.
|
inlineoverridevirtualnoexcept |
Handle mouse event. Called by the operating system to show the position and button state of the mouse. This is called very often so it must be made efficient. This function is also used to determine the mouse cursor.
In most cased overriding methods should call the super's handle_event() at the start of the function, to detect hover.
When this method does not handle the event the window will call handle_event() on the widget's parent.
| event | The mouse event, positions are in window coordinates. |
Reimplemented from tt::widget.
|
inlineoverridevirtualnoexcept |
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.
| window_position | The coordinate of the mouse on the window. Use fromWindowTransform to convert to widget-local coordinates. |
Reimplemented from tt::abstract_container_widget.
|
inlineoverridevirtualnoexcept |
Should be called right after allocating and constructing a widget.
Reimplemented from tt::widget.
|
inlineoverridevirtualnoexcept |
Update the constraints of the widget.
This function is called on each vertical sync, even if no drawing is to be done. It should recursively call updateConstraints() on each of the visible children, so they get a chance to update.
This function may be used for expensive calculations, such as text-shaping, which should only be done when the data changes. Because this function is called on every vertical sync it should cache these calculations.
Subclasses should call updateConstraints() on its base-class to check if the constraints where changed. Widget::update_constraints() will check if requestConstraints was set. Container::update_constraints() will check if any of the children changed constraints.
If the container, due to a change in constraints, wants the window to resize to the minimum size it should set window.requestResize to true.
This function will change what is returned by preferred_size() and preferred_base_line().
mutex must be locked by current thread. | display_time_point | The time point when the widget will be shown on the screen. |
| need_reconstrain | Force the widget to re-constrain. |
Reimplemented from tt::abstract_container_widget.
|
inlineoverridevirtualnoexcept |
Update the internal layout of the widget.
This function is called on each vertical sync, even if no drawing is to be done. It should recursively call updateLayout() on each of the visible children, so they get a chance to update.
This function may be used for expensive calculations, such as geometry calculations, which should only be done when the data or sizes change. Because this function is called on every vertical sync it should cache these calculations.
This function will likely call set_window_rectangle() and set_window_base_line() on its children, before calling updateLayout() on that child.
Subclasses should call updateLayout() on its children, call updateLayout() on its base class with forceLayout argument to the result of layoutRequest.exchange(false).
mutex must be locked by current thread. | display_time_point | The time point when the widget will be shown on the screen. |
| need_layout | Force the widget to layout |
Reimplemented from tt::abstract_container_widget.