psychic-ui 0.0.0
Loading...
Searching...
No Matches
psychic_ui::SystemWindow Class Referenceabstract

#include <SystemWindow.hpp>

Inheritance diagram for psychic_ui::SystemWindow:
psychic_ui::GLFWSystemWindow psychic_ui::SDL3SystemWindow

Public Types

using GLProc = void (*)()

Public Member Functions

 SystemWindow (std::shared_ptr< Window > window)
 SystemWindow (const SystemWindow &)=delete
SystemWindow & operator= (const SystemWindow &)=delete
 SystemWindow (SystemWindow &&)=delete
SystemWindow & operator= (SystemWindow &&)=delete
std::shared_ptr< Window > window () const
virtual bool render ()=0
virtual GLProc glProcAddress (const char *name) const =0
bool sharesContext () const
void setSharesContext (bool sharesContext)
int getX () const
int getY () const
int getWidth () const
int getHeight () const
int getFramebufferWidth () const
int getFramebufferHeight () const
float getPixelRatio () const
int getSamples () const
int getStencilBits () const
virtual void setTitle (const std::string &title)=0
virtual void setFullscreen (bool fullscreen)=0
virtual bool getMinimized () const =0
virtual void setMinimized (bool minimized)=0
virtual bool getMaximized () const =0
virtual void setMaximized (bool maximized)=0
virtual void setVisible (bool visible)=0
virtual void setCursor (Cursor cursor)=0
virtual void startDrag ()=0
virtual void stopDrag ()=0
virtual bool supportsDrag () const
virtual void setSize (int width, int height)=0
virtual void setPosition (int x, int y)=0
virtual std::chrono::nanoseconds gestureTime () const
virtual void wake ()
virtual ColorScheme colorScheme () const
virtual void startTextInput ()
virtual void stopTextInput ()
virtual void setTextInputArea (int x, int y, int width, int height, int cursor)
virtual std::string getClipboardText () const
virtual void setClipboardText (const std::string &text)

Protected Member Functions

void detach ()
void readFramebufferFormat ()

Protected Attributes

std::shared_ptr< Window > _window
bool _sharesContext {false}
bool _dragging {false}
int _stencilBits {8}
int _samples {0}
float _mouseX {0}
float _mouseY {0}
int _x {0}
int _y {0}
int _width {0}
int _height {0}
int _fbWidth {0}
int _fbHeight {0}
bool _focused {false}
bool _minimized {false}
bool _maximized {false}

Detailed Description

The platform side of a Window: a native window and its OpenGL context.

An implementation translates the platform's input and window events into calls on its Window and draws it with render(), with the window's GL context current.

Sizes: getWidth()/getHeight() are the window's size in the units the platform reports the mouse in, which is what the UI is laid out in. getFramebufferWidth()/getFramebufferHeight() are the size of what is drawn, in pixels: larger on a high pixel density display, by getPixelRatio().

Member Typedef Documentation

◆ GLProc

An OpenGL function, as GL loaders return them: to be cast to its own type before it is called

Member Function Documentation

◆ colorScheme()

virtual ColorScheme psychic_ui::SystemWindow::colorScheme ( ) const
inlinenodiscardvirtual

Whether the system is in light or dark mode, Unknown when it doesn't say (this default). An adapter that knows calls Window::handleColorSchemeChange when it changes.

Reimplemented in psychic_ui::SDL3SystemWindow.

◆ detach()

void psychic_ui::SystemWindow::detach ( )
protected

Lets go of the window and frees its Skia objects. A subclass calls it first thing in its destructor, while its GL context still exists and is current.

◆ gestureTime()

std::chrono::nanoseconds psychic_ui::SystemWindow::gestureTime ( ) const
nodiscardvirtual

The clock the backend's touch events are timed with, for Window::updateGestures: the steady clock unless the platform has its own

Reimplemented in psychic_ui::SDL3SystemWindow.

◆ getClipboardText()

std::string psychic_ui::SystemWindow::getClipboardText ( ) const
nodiscardvirtual

The system clipboard's text, in UTF-8. Without a system clipboard (this default), a clipboard that only lives in this system window.

Reimplemented in psychic_ui::GLFWSystemWindow, and psychic_ui::SDL3SystemWindow.

◆ glProcAddress()

virtual GLProc psychic_ui::SystemWindow::glProcAddress ( const char * name) const
pure virtual

Address of an OpenGL function in this window's context, which Skia builds its GL interface from

Implemented in psychic_ui::GLFWSystemWindow, and psychic_ui::SDL3SystemWindow.

◆ readFramebufferFormat()

void psychic_ui::SystemWindow::readFramebufferFormat ( )
protected

Reads the sample count and stencil bits of the current context's default framebuffer, which the Skia render target must match

◆ render()

virtual bool psychic_ui::SystemWindow::render ( )
pure virtual

Draws the window into its framebuffer, without presenting it.

Returns
false when there's nothing to draw (the window is hidden)

Implemented in psychic_ui::GLFWSystemWindow, and psychic_ui::SDL3SystemWindow.

◆ setTextInputArea()

void psychic_ui::SystemWindow::setTextInputArea ( int x,
int y,
int width,
int height,
int cursor )
virtual

Where text is being typed (window coordinates), with the caret cursor from its left, so that an on-screen keyboard or an input method's candidates stay clear of it. Adapters without either ignore it.

Reimplemented in psychic_ui::SDL3SystemWindow.

◆ sharesContext()

bool psychic_ui::SystemWindow::sharesContext ( ) const
nodiscard

Whether something other than Psychic UI also draws with this GL context (a host application): Skia then forgets the GL state it caches before each frame. True for the adapters that wrap a host's window; a host that draws nothing else can turn it off.

◆ supportsDrag()

bool psychic_ui::SystemWindow::supportsDrag ( ) const
nodiscardvirtual

Whether the window can be moved from inside it, by Window::isDragArea or startDrag()

Reimplemented in psychic_ui::GLFWSystemWindow, and psychic_ui::SDL3SystemWindow.

◆ wake()

virtual void psychic_ui::SystemWindow::wake ( )
inlinevirtual

Wake the loop that waits for this window's events, so that it draws (Window::requestFrame). May be called from another thread. Nothing by default: a loop that doesn't wait needs nothing.

Reimplemented in psychic_ui::GLFWSystemWindow, and psychic_ui::SDL3SystemWindow.


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