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

Public Member Functions

 gui_window (gui_window const &)=delete
 
gui_windowoperator= (gui_window const &)=delete
 
 gui_window (gui_window &&)=delete
 
gui_windowoperator= (gui_window &&)=delete
 
 gui_window (std::unique_ptr< widget_intf > widget) noexcept
 
template<typename Widget >
Widget & widget () const noexcept
 
void set_title (label title) noexcept
 
void render (utc_nanoseconds display_time_point)
 Update window.
 
void set_cursor (mouse_cursor cursor) noexcept
 Set the mouse cursor icon.
 
void close_window ()
 Ask the operating system to close this window.
 
void set_size_state (gui_window_size state) noexcept
 Set the size-state of the window.
 
aarectangle workspace_rectangle () const noexcept
 The rectangle of the workspace of the screen where the window is currently located.
 
aarectangle fullscreen_rectangle () const noexcept
 The rectangle of the screen where the window is currently located.
 
gui_window_size size_state () const noexcept
 Get the size-state of the window.
 
hi::subpixel_orientation subpixel_orientation () const noexcept
 
void open_system_menu ()
 Open the system menu of the window.
 
void set_window_size (extent2 new_extent)
 Ask the operating system to set the size of this window.
 
void update_mouse_target (widget_id new_target_id, point2 position={}) noexcept
 
void update_keyboard_target (widget_id new_target_id, keyboard_focus_group group=keyboard_focus_group::normal) noexcept
 Change the keyboard focus to the given widget.
 
void update_keyboard_target (widget_id start_widget, keyboard_focus_group group, keyboard_focus_direction direction) noexcept
 Change the keyboard focus to the previous or next widget from the given widget.
 
void update_keyboard_target (keyboard_focus_group group, keyboard_focus_direction direction) noexcept
 Change the keyboard focus to the given, previous or next widget.
 
std::optional< gstringget_text_from_clipboard () const noexcept
 Get text from the clipboard.
 
void put_text_on_clipboard (gstring_view text) const noexcept
 Put text on the clipboard.
 
translate2 window_to_screen () const noexcept
 
translate2 screen_to_window () const noexcept
 
bool process_event (gui_event event) noexcept
 Process the event.
 

Data Fields

HWND win32Window = nullptr
 
std::unique_ptr< gfx_surfacesurface
 
aarectangle rectangle
 The current rectangle of the window relative to the screen.
 
mouse_cursor current_mouse_cursor = mouse_cursor::None
 The current cursor.
 
bool resizing = false
 
hi::pixel_density pixel_density = {pixels_per_inch(96.0f), device_type::desktop}
 Pixel density of the screen where the window is located.
 
hi::theme theme = {}
 Theme to use to draw the widgets on this window.
 
extent2 widget_size
 The size of the widget.
 
notifier< void()> closing
 Notifier used when the window is closing.
 

Member Function Documentation

◆ close_window()

void v1::gui_window::close_window ( )
inline

Ask the operating system to close this window.

◆ fullscreen_rectangle()

aarectangle v1::gui_window::fullscreen_rectangle ( ) const
inlinenoexcept

The rectangle of the screen where the window is currently located.

◆ get_text_from_clipboard()

std::optional< gstring > v1::gui_window::get_text_from_clipboard ( ) const
inlinenoexcept

Get text from the clipboard.

Note
This is part of the window as some operating systems need to know from which window the text was posted.
Returns
The text from the clipboard.
Return values
emptyWhen the clipboard is locked by another application, on error, if the data on the clipboard can not be converted to text or if the clipboard is empty.

◆ open_system_menu()

void v1::gui_window::open_system_menu ( )
inline

Open the system menu of the window.

On windows 10 this is activated by pressing Alt followed by Spacebar.

◆ process_event()

bool v1::gui_window::process_event ( gui_event event)
inlinenoexcept

Process the event.

This is called by the event handler to start processing events. The events are translated and then uses send_event_to_widget() to send the events to the widgets in some priority ordering.

It may also be called from within the event_handle() of widgets.

◆ put_text_on_clipboard()

void v1::gui_window::put_text_on_clipboard ( gstring_view text) const
inlinenoexcept

Put text on the clipboard.

Note
This is part of the window as some operating systems need to know from which window the text was posted.
Parameters
textThe text to place on the clipboard.

◆ render()

void v1::gui_window::render ( utc_nanoseconds display_time_point)
inline

Update window.

This will update animations and redraw all widgets managed by this window.

◆ set_cursor()

void v1::gui_window::set_cursor ( mouse_cursor cursor)
inlinenoexcept

Set the mouse cursor icon.

◆ set_size_state()

void v1::gui_window::set_size_state ( gui_window_size state)
inlinenoexcept

Set the size-state of the window.

This function is used to change the size of the window to one of the predefined states: normal, minimized, maximized or full-screen.

◆ set_window_size()

void v1::gui_window::set_window_size ( extent2 new_extent)
inline

Ask the operating system to set the size of this window.

◆ size_state()

gui_window_size v1::gui_window::size_state ( ) const
inlinenoexcept

Get the size-state of the window.

◆ update_keyboard_target() [1/3]

void v1::gui_window::update_keyboard_target ( keyboard_focus_group group,
keyboard_focus_direction direction )
inlinenoexcept

Change the keyboard focus to the given, previous or next widget.

This function will find the closest widget from the current widget which belongs to the given group; if none is found, or if the original selected widget is found, then no widget will be in focus.

Parameters
groupThe group the widget must belong to.
directionThe direction to search in, or current to select the current widget.

◆ update_keyboard_target() [2/3]

void v1::gui_window::update_keyboard_target ( widget_id new_target_id,
keyboard_focus_group group = keyboard_focus_group::normal )
inlinenoexcept

Change the keyboard focus to the given widget.

If the group of the widget is incorrect then no widget will be in focus.

Parameters
widgetThe new widget to focus, or empty to remove all keyboard focus.
groupThe group the widget must belong to.

◆ update_keyboard_target() [3/3]

void v1::gui_window::update_keyboard_target ( widget_id start_widget,
keyboard_focus_group group,
keyboard_focus_direction direction )
inlinenoexcept

Change the keyboard focus to the previous or next widget from the given widget.

This function will find the closest widget from the given widget which belongs to the given group; if none is found, or if the original selected widget is found, then no widget will be in focus.

Parameters
start_widgetThe widget to use as the start point for a new widget to select.
groupThe group the widget must belong to.
directionThe direction to search in, or current to select the current widget.

◆ workspace_rectangle()

aarectangle v1::gui_window::workspace_rectangle ( ) const
inlinenoexcept

The rectangle of the workspace of the screen where the window is currently located.

Field Documentation

◆ closing

notifier<void()> v1::gui_window::closing

Notifier used when the window is closing.

It is expected that after notifying these callbacks the instance of this class is destroyed.

◆ current_mouse_cursor

mouse_cursor v1::gui_window::current_mouse_cursor = mouse_cursor::None

The current cursor.

Used for optimizing when the operating system cursor is updated. Set to mouse_cursor::None at the start (for the wait icon) and when the operating system is going to display another icon to make sure when it comes back in the application the cursor will be updated correctly.

◆ pixel_density

hi::pixel_density v1::gui_window::pixel_density = {pixels_per_inch(96.0f), device_type::desktop}

Pixel density of the screen where the window is located.

If the window is located on multiple screens then one of the screens is used as the source for the pixel-density.

◆ rectangle

aarectangle v1::gui_window::rectangle

The current rectangle of the window relative to the screen.

The screen rectangle is set by the operating system event loop.

This rectangle is used by the operating system event loop hit-testing to determine the position of screen coordinates to window coordinates.

The size of this rectangle is used to laying out widgets and setting the size of the gfx_surface during rendering.

◆ resizing

bool v1::gui_window::resizing = false

The window is currently being resized by the user. We can disable expensive redraws during rendering until this is false again.

◆ theme

hi::theme v1::gui_window::theme = {}

Theme to use to draw the widgets on this window.

The sizes and colors of the theme have already been adjusted to the window's state and ppi.

◆ widget_size

extent2 v1::gui_window::widget_size

The size of the widget.


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