|
HikoGUI
A low latency retained GUI
|
Public Types | |
| using | super = widget |
Public Member Functions | |
| template<typename Content , typename Aperture , typename Offset > | |
| scroll_bar_widget (gui_window &window, widget *parent, Content &&content, Aperture &&aperture, Offset &&offset) noexcept | |
| bool | constrain (utc_nanoseconds display_time_point, bool need_reconstrain) noexcept override |
| Update the constraints of the widget. | |
| void | layout (utc_nanoseconds display_time_point, bool need_layout) noexcept override |
| Update the internal layout of the widget. | |
| void | draw (draw_context context, utc_nanoseconds display_time_point) noexcept override |
| Draw the widget. | |
| hitbox | hitbox_test (point2 position) const noexcept override |
| Find the widget that is under the mouse cursor. | |
| bool | handle_event (mouse_event const &event) noexcept |
| bool | accepts_keyboard_focus (keyboard_focus_group group) const noexcept override |
| Check if the widget will accept keyboard focus. | |
| color | background_color () const noexcept override |
| color | foreground_color () const noexcept override |
Public Member Functions inherited from tt::widget | |
| widget (gui_window &window, widget *parent) noexcept | |
| widget (const widget &)=delete | |
| widget & | operator= (const widget &)=delete |
| widget (widget &&)=delete | |
| widget & | operator= (widget &&)=delete |
| virtual void | init () noexcept |
| Should be called right after allocating and constructing a widget. | |
| virtual void | deinit () noexcept |
| Should be called right after allocating and constructing a widget. | |
| bool | is_gui_thread () const noexcept |
| tt::theme const & | theme () const noexcept |
| Get the theme. | |
| tt::font_book & | font_book () const noexcept |
| Get the font book. | |
| virtual float | margin () const noexcept |
| Get the margin around the Widget. | |
| extent2 | minimum_size () const noexcept |
| Minimum size. | |
| extent2 | preferred_size () const noexcept |
| Preferred size. | |
| extent2 | maximum_size () const noexcept |
| Maximum size. | |
| void | set_layout_parameters (geo::transformer auto const &local_to_parent, extent2 size, aarectangle const &clipping_rectangle) noexcept |
| Set the location and size of the widget inside the window. | |
| void | set_layout_parameters_from_parent (aarectangle child_rectangle, aarectangle parent_clipping_rectangle, float draw_layer_delta) noexcept |
| void | set_layout_parameters_from_parent (aarectangle child_rectangle) noexcept |
| matrix3 | parent_to_local () const noexcept |
| matrix3 | local_to_parent () const noexcept |
| matrix3 | window_to_local () const noexcept |
| matrix3 | local_to_window () const noexcept |
| extent2 | size () const noexcept |
| float | width () const noexcept |
| float | height () const noexcept |
| aarectangle | rectangle () const noexcept |
| Get the rectangle in local coordinates. | |
| virtual float | base_line () const noexcept |
| Return the base-line where the text should be located. | |
| aarectangle | clipping_rectangle () const noexcept |
| virtual color | focus_color () const noexcept |
| virtual color | accent_color () const noexcept |
| virtual color | label_color () const noexcept |
| virtual void | request_redraw () const noexcept |
| virtual bool | handle_event (command command) noexcept |
| Handle command. | |
| virtual bool | handle_event (std::vector< command > const &commands) noexcept |
| virtual bool | handle_command_recursive (command command, std::vector< widget const * > const &reject_list) noexcept |
| Handle command recursive. | |
| virtual bool | handle_event (keyboard_event const &event) noexcept |
| Handle keyboard event. | |
| virtual widget const * | find_next_widget (widget const *current_keyboard_widget, keyboard_focus_group group, keyboard_focus_direction direction) const noexcept |
| Find the next widget that handles keyboard focus. | |
| widget const * | find_first_widget (keyboard_focus_group group) const noexcept |
| widget const * | find_last_widget (keyboard_focus_group group) const noexcept |
| 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. | |
| virtual void | scroll_to_show (tt::rectangle rectangle) noexcept |
| Scroll to show the given rectangle on the window. | |
| std::vector< widget const * > | parent_chain () const noexcept |
| Get a list of parents of a given widget. | |
| void | clear () noexcept |
| Remove and deallocate all child widgets. | |
| widget & | add_widget (std::unique_ptr< widget > widget) noexcept |
| Add a widget directly to this widget. | |
Static Public Attributes | |
| static constexpr tt::axis | axis = Axis |
Additional Inherited Members | |
Data Fields inherited from tt::widget | |
| gui_window & | window |
| Convenient reference to the Window. | |
| widget *const | parent |
| Pointer to the parent widget. | |
| std::string | id |
| A name of widget, should be unique between siblings. | |
| observable< bool > | enabled = true |
| The widget is enabled. | |
| observable< bool > | visible = true |
| The widget is visible. | |
| float | draw_layer |
| The draw layer of the widget. | |
| int | semantic_layer |
| The draw layer of the widget. | |
| int | logical_layer |
| The logical layer of the widget. | |
|
inlineoverridevirtualnoexcept |
Check if the widget will accept keyboard focus.
mutex must be locked by current thread. Reimplemented from tt::widget.
|
inlineoverridevirtualnoexcept |
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.
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 constrain() on its base-class to check if its or any of its children's constraints where changed, before doing specific constraining
If the container, due to a change in constraints, wants the window to resize to the minimum size it should set window::request_resize to true.
widget::minimum_size(), widget::preferred_size() and widget::maximum_size(). | 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::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::widget.
|
inlineoverridevirtualnoexcept |
Reimplemented from tt::widget.
|
inlinevirtualnoexcept |
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.
| position | The coordinate of the mouse local to the widget. |
Reimplemented from tt::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.
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.
Subclasses should call widget::set_layout_parameters() to position and size each child relative to this widget. At the end of the function the subclass should call layout() on its base-class to recursively update the layout of the children.
widget::set_layout_parameters() should be called. widget::size() and the transformation matrices. | 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::widget.