ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::IPlatform Class Referenceabstract

Abstract windowing, timing, input, and clipboard backend. More...

#include <UIContext.hpp>

Inheritance diagram for ZenitUI::IPlatform:
[legend]

Public Member Functions

virtual Vec2 viewportSize ()=0
 Return the current window/surface dimensions in logical pixels.
virtual PointerState pointer ()=0
 Return the current pointer position (logical pixels), scroll wheel delta, and button states.
virtual double time ()=0
 Return a monotonic clock timestamp in seconds.
virtual ModifierState modifiers ()=0
 Return the current state of modifier keys (shift, ctrl, alt, super).
virtual InputEvents pollInputEvents ()=0
 Drain and return keyboard events queued since the previous frame.
virtual float dpiScale ()=0
 Return the physical-to-logical DPI scale factor (e.g.
virtual EdgeInsets safeArea ()=0
 Return screen safe-area insets in logical pixels (notches, rounded corners, system bars).
virtual void setClipboardText (const std::string &text)=0
 Copy UTF-8 text to the operating system clipboard.
virtual std::string getClipboardText ()=0
 Read UTF-8 text from the operating system clipboard (empty string if unavailable).
virtual void setCursor (CursorShape)
 Request the OS/windowing system to display the given cursor shape.
virtual void setTextInputRect (Rect, float=0.0f)
 Inform the OS IME of the active text-input rect and caret offset (in logical window coordinates) so candidate windows appear at the caret.

Detailed Description

Abstract windowing, timing, input, and clipboard backend.

Polled once per frame by UIContext::beginFrame(). See Writing a Custom Backend for invariants and Backends, TextEngine, UTF-8 & Debugging for reference implementations (RaylibPlatform, MockPlatform).

Member Function Documentation

◆ dpiScale()

virtual float ZenitUI::IPlatform::dpiScale ( )
pure virtual

Return the physical-to-logical DPI scale factor (e.g.

1.0f on standard displays, 2.0f on Retina).

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ getClipboardText()

virtual std::string ZenitUI::IPlatform::getClipboardText ( )
pure virtual

Read UTF-8 text from the operating system clipboard (empty string if unavailable).

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ modifiers()

virtual ModifierState ZenitUI::IPlatform::modifiers ( )
pure virtual

Return the current state of modifier keys (shift, ctrl, alt, super).

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ pointer()

virtual PointerState ZenitUI::IPlatform::pointer ( )
pure virtual

Return the current pointer position (logical pixels), scroll wheel delta, and button states.

Edge-triggered fields (ButtonState::pressed, ButtonState::released, PointerState::wheelY) must fire for one frame only; ButtonState::down stays true while held.

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ pollInputEvents()

virtual InputEvents ZenitUI::IPlatform::pollInputEvents ( )
pure virtual

Drain and return keyboard events queued since the previous frame.

InputEvents::chars and InputEvents::keys are edge-triggered (one frame); InputEvents::held lists keys currently held down for repeat handling.

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ safeArea()

virtual EdgeInsets ZenitUI::IPlatform::safeArea ( )
pure virtual

Return screen safe-area insets in logical pixels (notches, rounded corners, system bars).

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ setClipboardText()

virtual void ZenitUI::IPlatform::setClipboardText ( const std::string & text)
pure virtual

Copy UTF-8 text to the operating system clipboard.

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ setCursor()

virtual void ZenitUI::IPlatform::setCursor ( CursorShape )
inlinevirtual

Request the OS/windowing system to display the given cursor shape.

Reimplemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ setTextInputRect()

virtual void ZenitUI::IPlatform::setTextInputRect ( Rect ,
float = 0.0f )
inlinevirtual

Inform the OS IME of the active text-input rect and caret offset (in logical window coordinates) so candidate windows appear at the caret.

Pass an empty rect (width <= 0 || height <= 0) when no text widget is focused.

Reimplemented in ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ time()

virtual double ZenitUI::IPlatform::time ( )
pure virtual

Return a monotonic clock timestamp in seconds.

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.

◆ viewportSize()

virtual Vec2 ZenitUI::IPlatform::viewportSize ( )
pure virtual

Return the current window/surface dimensions in logical pixels.

Implemented in ZenitUI::RaylibPlatform, ZenitUI::SDL3Platform, and ZenitUI::Test::MockPlatform.


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