HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields | Friends
hi::v1::gui_event Class Reference

#include <hikogui/GUI/gui_event.hpp>

Public Member Functions

constexpr gui_event (gui_event_type type, utc_nanoseconds time_point, hi::keyboard_modifiers keyboard_modifiers, hi::keyboard_state keyboard_state) noexcept
 Create a GUI event.
 
constexpr gui_event () noexcept
 Create an empty GUI event.
 
 gui_event (gui_event_type type) noexcept
 Create am empty GUI event.
 
 gui_event (gui_event_type type, aarectangle rectangle) noexcept
 Create a rectangle event.
 
 gui_event (gui_event_type type, keyboard_virtual_key key, hi::keyboard_modifiers keyboard_modifiers=keyboard_modifiers::none, hi::keyboard_state keyboard_state=keyboard_state::idle) noexcept
 Create a GUI event.
 
constexpr gui_event (gui_event const &) noexcept=default
 
constexpr gui_event (gui_event &&) noexcept=default
 
constexpr gui_eventoperator= (gui_event const &) noexcept=default
 
constexpr gui_eventoperator= (gui_event &&) noexcept=default
 
constexpr gui_event_type type () const noexcept
 Get the event type.
 
constexpr void set_type (gui_event_type type) noexcept
 Change the type of the gui_event.
 
mouse_event_datamouse () noexcept
 Get the mouse event information.
 
mouse_event_data const & mouse () const noexcept
 Get the mouse event information.
 
keyboard_virtual_key & key () noexcept
 Get the key from the keyboard event.
 
keyboard_virtual_key const & key () const noexcept
 Get the key from the keyboard event.
 
hi::grapheme & grapheme () noexcept
 Get the grapheme entered on the keyboard.
 
hi::grapheme const & grapheme () const noexcept
 Get the grapheme entered on the keyboard.
 
aarectanglerectangle () noexcept
 
aarectangle const & rectangle () const noexcept
 
keyboard_target_datakeyboard_target () noexcept
 
keyboard_target_data const & keyboard_target () const noexcept
 
gstring & clipboard_data () noexcept
 
gstring const & clipboard_data () const noexcept
 
constexpr bool operator== (gui_event_type event_type) const noexcept
 
constexpr bool operator== (gui_event_variant event_variant) const noexcept
 
constexpr bool empty () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr gui_event_variant variant () const noexcept
 
constexpr bool is_left_button_up (aarectangle active_area) const noexcept
 Check if this event is for a left-button-up event while the mouse pointer is in the given area.
 
constexpr vector2 drag_delta () const noexcept
 Get the location of the mouse relative to the start of a drag.
 

Static Public Member Functions

static gui_event make_mouse_enter (point2 position) noexcept
 Create a mouse enter event.
 
static gui_event keyboard_grapheme (hi::grapheme grapheme) noexcept
 
static gui_event keyboard_partial_grapheme (hi::grapheme grapheme) noexcept
 
static gui_event window_set_keyboard_target (widget_id id, keyboard_focus_group group=keyboard_focus_group::normal, keyboard_focus_direction direction=keyboard_focus_direction::here) noexcept
 
static gui_event make_clipboard_event (gui_event_type type, gstring_view text) noexcept
 Create clipboard event.
 

Data Fields

utc_nanoseconds time_point
 The time when the event was created.
 
keyboard_modifiers keyboard_modifiers
 Keyboard modifiers: shift, ctrl, alt, etc.
 
keyboard_state keyboard_state
 State of the keyboard; caps-lock, num-lock, scroll-lock.
 

Friends

constexpr friend gui_event operator* (translate2 const &transform, gui_event const &rhs) noexcept
 Transform a gui-event to another coordinate system.
 

Detailed Description

A user interface event.

Constructor & Destructor Documentation

◆ gui_event() [1/5]

constexpr hi::v1::gui_event::gui_event ( gui_event_type type,
utc_nanoseconds time_point,
hi::keyboard_modifiers keyboard_modifiers,
hi::keyboard_state keyboard_state )
inlineconstexprnoexcept

Create a GUI event.

Parameters
typeThe type of the event.
time_pointThe time when the was received.
keyboard_modifiersA list of modifiers key that where hold down: alt, ctrl, shift.
keyboard_stateThe state of the keyboard: scroll-lock, num-lock, caps-lock.

◆ gui_event() [2/5]

constexpr hi::v1::gui_event::gui_event ( )
inlineconstexprnoexcept

Create an empty GUI event.

◆ gui_event() [3/5]

hi::v1::gui_event::gui_event ( gui_event_type type)
inlinenoexcept

Create am empty GUI event.

Parameters
typeThe type of the event.

◆ gui_event() [4/5]

hi::v1::gui_event::gui_event ( gui_event_type type,
aarectangle rectangle )
inlinenoexcept

Create a rectangle event.

Parameters
typeThe type of the rectangle event.
rectangleThe rectangle for this event.

◆ gui_event() [5/5]

hi::v1::gui_event::gui_event ( gui_event_type type,
keyboard_virtual_key key,
hi::keyboard_modifiers keyboard_modifiers = keyboard_modifiers::none,
hi::keyboard_state keyboard_state = keyboard_state::idle )
inlinenoexcept

Create a GUI event.

Parameters
typeThe type of the key event.
keyThe virtual key that was pressed/released
keyboard_modifiersA list of modifiers key that where hold down: alt, ctrl, shift.
keyboard_stateThe state of the keyboard: scroll-lock, num-lock, caps-lock.

Member Function Documentation

◆ drag_delta()

constexpr vector2 hi::v1::gui_event::drag_delta ( ) const
inlineconstexprnoexcept

Get the location of the mouse relative to the start of a drag.

◆ grapheme() [1/2]

hi::grapheme const & hi::v1::gui_event::grapheme ( ) const
inlinenoexcept

Get the grapheme entered on the keyboard.

Returns
a referene to the grapheme.

◆ grapheme() [2/2]

hi::grapheme & hi::v1::gui_event::grapheme ( )
inlinenoexcept

Get the grapheme entered on the keyboard.

Returns
a referene to the grapheme.

◆ is_left_button_up()

constexpr bool hi::v1::gui_event::is_left_button_up ( aarectangle active_area) const
inlineconstexprnoexcept

Check if this event is for a left-button-up event while the mouse pointer is in the given area.

◆ key() [1/2]

keyboard_virtual_key const & hi::v1::gui_event::key ( ) const
inlinenoexcept

Get the key from the keyboard event.

Returns
a referene to the key.

◆ key() [2/2]

keyboard_virtual_key & hi::v1::gui_event::key ( )
inlinenoexcept

Get the key from the keyboard event.

Returns
a referene to the key.

◆ make_clipboard_event()

static gui_event hi::v1::gui_event::make_clipboard_event ( gui_event_type type,
gstring_view text )
inlinestaticnoexcept

Create clipboard event.

Parameters
typeEither gui_event_type::text_edit_paste or gui_event_type::window_set_clipboard.
textThe clipboard data in text form.

◆ make_mouse_enter()

static gui_event hi::v1::gui_event::make_mouse_enter ( point2 position)
inlinestaticnoexcept

Create a mouse enter event.

Parameters
positionThe position where the mouse entered.

◆ mouse() [1/2]

mouse_event_data const & hi::v1::gui_event::mouse ( ) const
inlinenoexcept

Get the mouse event information.

Returns
a referene to the mouse data.

◆ mouse() [2/2]

mouse_event_data & hi::v1::gui_event::mouse ( )
inlinenoexcept

Get the mouse event information.

Returns
a referene to the mouse data.

◆ set_type()

constexpr void hi::v1::gui_event::set_type ( gui_event_type type)
inlineconstexprnoexcept

Change the type of the gui_event.

Note
If the variant changes of this event the associated data is cleared.
Parameters
typeThe new type for the gui_event.

◆ type()

constexpr gui_event_type hi::v1::gui_event::type ( ) const
inlineconstexprnoexcept

Get the event type.

Friends And Related Symbol Documentation

◆ operator*

constexpr friend gui_event operator* ( translate2 const & transform,
gui_event const & rhs )
friend

Transform a gui-event to another coordinate system.

This operations is used mostly to transform mouse evens to a widget's local coordinate system.

Parameters
transformThe transform object
rhsThe event to transform.
Returns
The transformed event.

Field Documentation

◆ keyboard_modifiers

keyboard_modifiers hi::v1::gui_event::keyboard_modifiers

Keyboard modifiers: shift, ctrl, alt, etc.

This may be used for in combination with both keyboard and mouse events.

◆ keyboard_state

keyboard_state hi::v1::gui_event::keyboard_state

State of the keyboard; caps-lock, num-lock, scroll-lock.

◆ time_point

utc_nanoseconds hi::v1::gui_event::time_point

The time when the event was created.


The documentation for this class was generated from the following file: