ReXGlue SDK
Loading...
Searching...
No Matches
rex::ui::IUIDriver Class Referenceabstract

#include <rex/ui/ui_driver.h>

Inheritance diagram for rex::ui::IUIDriver:
[legend]

Public Member Functions

virtual bool HasDisplay () const =0
virtual Result< void > OpenWindow (const WindowConfig &config)=0
virtual void CloseUIWindow ()=0
virtual void SetTitle (std::string_view title)=0
virtual void SetSize (u32 width, u32 height)=0
virtual void SetLimits (u32 min_width, u32 min_height, ui::AspectRatio ratio)=0
virtual void SetFullscreen (bool fullscreen, bool exclusive, i32 monitor, u32 mode_width, u32 mode_height)=0
virtual void RaiseWindow ()=0
virtual void SetCursorShape (bool visible, CursorShape shape)=0
virtual void SetPointerMode (PointerMode mode)=0
virtual void CaptureMouse (bool captured)=0
virtual f32 GetContentScale () const =0
virtual ui::WindowSize GetWindowSize () const =0
virtual bool HasFocus () const =0
virtual void SetTextInputActive (bool active)=0
virtual Result< NativeWindow > GetNativeWindow () const =0
virtual bool WaitEvents (IUIEventListener &listener, u32 timeout_ms)=0
virtual void WakeUp ()=0
virtual Result< u32 > ShowMessageBox (MessageType type, std::string_view title, std::string_view body, std::span< const std::string > buttons)=0
virtual Result< std::vector< std::filesystem::path > > ShowFileDialog (const ui::FileDialogConfig &config)=0
virtual std::vector< ui::Monitor > GetDisplays ()=0
virtual std::vector< ui::HostLocale > GetPreferredLocales ()=0
virtual std::string GetClipboardText ()=0
virtual void SetClipboardText (std::string_view text)=0
Public Member Functions inherited from rex::IDriver
virtual std::string_view GetName () const =0
virtual Result< void > Initialize (IDriverContext &context)=0
virtual void Shutdown ()=0

Detailed Description

A windowing library with one window, the event pump, native dialogs, displays, locales and the clipboard. UISystem makes every call on the UI thread except WakeUp. A driver owns only its own ui.<name>.* settings and never draws.

Member Function Documentation

◆ CaptureMouse()

virtual void rex::ui::IUIDriver::CaptureMouse ( bool captured)
pure virtual

Captures the mouse so a drag keeps reporting outside the window, or releases it.

◆ GetClipboardText()

virtual std::string rex::ui::IUIDriver::GetClipboardText ( )
pure virtual
Returns
The text, empty when none.

◆ GetContentScale()

virtual f32 rex::ui::IUIDriver::GetContentScale ( ) const
pure virtual

Returns the ratio of window pixels to layout size, 1 when the host has none.

◆ GetNativeWindow()

virtual Result< NativeWindow > rex::ui::IUIDriver::GetNativeWindow ( ) const
nodiscardpure virtual

Returns the window's native handles, which GraphicsSystem presents to, or kNotFound when the window is not open.

◆ GetPreferredLocales()

virtual std::vector< ui::HostLocale > rex::ui::IUIDriver::GetPreferredLocales ( )
pure virtual

Lists the host's preferred locales, most preferred first.

◆ GetWindowSize()

virtual ui::WindowSize rex::ui::IUIDriver::GetWindowSize ( ) const
pure virtual

Returns the window size in pixels, zero when the window is not open.

◆ HasDisplay()

virtual bool rex::ui::IUIDriver::HasDisplay ( ) const
pure virtual

Reports whether a display exists.

Returns
False on a dummy video driver, where UISystem is headless.

◆ OpenWindow()

virtual Result< void > rex::ui::IUIDriver::OpenWindow ( const WindowConfig & config)
nodiscardpure virtual
Parameters
configThe window title, size and fullscreen state.
Returns
Ok, or an error, and UISystem then runs headless.

◆ SetClipboardText()

virtual void rex::ui::IUIDriver::SetClipboardText ( std::string_view text)
pure virtual

Sets the clipboard text.

◆ SetCursorShape()

virtual void rex::ui::IUIDriver::SetCursorShape ( bool visible,
CursorShape shape )
pure virtual

Shows or hides the cursor and sets its shape.

Parameters
shapeThe shape while shown.

◆ SetFullscreen()

virtual void rex::ui::IUIDriver::SetFullscreen ( bool fullscreen,
bool exclusive,
i32 monitor,
u32 mode_width,
u32 mode_height )
pure virtual

Enters or leaves fullscreen on a display.

Parameters
exclusiveTrue for exclusive fullscreen, false for borderless.
mode_widthExclusive mode width, 0 for the desktop mode.
mode_heightExclusive mode height, 0 for the desktop mode.

◆ SetLimits()

virtual void rex::ui::IUIDriver::SetLimits ( u32 min_width,
u32 min_height,
ui::AspectRatio ratio )
pure virtual

Sets the smallest client size and the shape kept on resize.

◆ SetPointerMode()

virtual void rex::ui::IUIDriver::SetPointerMode ( PointerMode mode)
pure virtual

Sets the pointer mode. When the host refuses relative motion the driver recenters the pointer and reports dx and dy.

◆ SetSize()

virtual void rex::ui::IUIDriver::SetSize ( u32 width,
u32 height )
pure virtual

Sets the client size of a window not in fullscreen.

◆ SetTextInputActive()

virtual void rex::ui::IUIDriver::SetTextInputActive ( bool active)
pure virtual

Starts or stops text input, which turns on an on screen keyboard where the host has one.

◆ ShowFileDialog()

virtual Result< std::vector< std::filesystem::path > > rex::ui::IUIDriver::ShowFileDialog ( const ui::FileDialogConfig & config)
nodiscardpure virtual

Shows the native open or save dialog and waits.

Parameters
configThe mode, filters and start folder.
Returns
The paths chosen, empty when canceled.

◆ ShowMessageBox()

virtual Result< u32 > rex::ui::IUIDriver::ShowMessageBox ( MessageType type,
std::string_view title,
std::string_view body,
std::span< const std::string > buttons )
nodiscardpure virtual

Shows a native message box and waits.

Parameters
typeInformation, warning or error.
buttonsThe button labels, one OK button when empty.
Returns
The index of the button chosen, or an error when it could not show.

◆ WaitEvents()

virtual bool rex::ui::IUIDriver::WaitEvents ( IUIEventListener & listener,
u32 timeout_ms )
pure virtual

Waits for events and delivers each one, in order.

Parameters
timeout_msThe longest wait, 0 delivers what is waiting and returns.
Returns
False once the host asked the app to quit.

◆ WakeUp()

virtual void rex::ui::IUIDriver::WakeUp ( )
pure virtual

Ends a WaitEvents in progress. Any thread.


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