|
psychic-ui 0.0.0
|
#include <SDL3SystemWindow.hpp>
Public Member Functions | |
| SDL3SystemWindow (std::shared_ptr< Window > window, SDL_Window *sdlWindow, SDL_GLContext glContext) | |
| SDL3SystemWindow (const SDL3SystemWindow &)=delete | |
| SDL3SystemWindow & | operator= (const SDL3SystemWindow &)=delete |
| SDL3SystemWindow (SDL3SystemWindow &&)=delete | |
| SDL3SystemWindow & | operator= (SDL3SystemWindow &&)=delete |
| SDL_Window * | sdlWindow () const |
| bool | handleEvent (const SDL_Event &event) |
| bool | render () override |
| GLProc | glProcAddress (const char *name) const override |
| void | setTitle (const std::string &title) override |
| void | setFullscreen (bool fullscreen) override |
| bool | getMinimized () const override |
| void | setMinimized (bool minimized) override |
| bool | getMaximized () const override |
| void | setMaximized (bool maximized) override |
| void | setVisible (bool visible) override |
| void | setCursor (Cursor cursor) override |
| void | startDrag () override |
| void | stopDrag () override |
| bool | supportsDrag () const override |
| void | setSize (int width, int height) override |
| void | setPosition (int x, int y) override |
| void | startTextInput () override |
| void | stopTextInput () override |
| void | setTextInputArea (int x, int y, int width, int height, int cursor) override |
| std::chrono::nanoseconds | gestureTime () const override |
| void | wake () override |
| ColorScheme | colorScheme () const override |
| std::string | getClipboardText () const override |
| void | setClipboardText (const std::string &text) override |
| bool | installHitTest () |
| SDL_HitTestResult | hitTest (int x, int y) |
| Public Member Functions inherited from psychic_ui::SystemWindow | |
| 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 |
| 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 |
Static Public Member Functions | |
| static Uint32 | wakeEventType () |
| static Mod | mapMods (SDL_Keymod mods) |
| static Key | mapKey (SDL_Keycode keycode) |
Protected Member Functions | |
| virtual SDL_TouchDeviceType | touchDeviceType (SDL_TouchID touchID) const |
| void | handleFingerEvent (const SDL_TouchFingerEvent &finger) |
| void | handlePenButton (MouseButton button, bool down, float x, float y) |
| void | readSize () |
| Protected Member Functions inherited from psychic_ui::SystemWindow | |
| void | detach () |
| void | readFramebufferFormat () |
Protected Attributes | |
| SDL_Window * | _sdlWindow {nullptr} |
| SDL_GLContext | _glContext {nullptr} |
| std::array< SDL_Cursor *, 6 > | _cursors {} |
| float | _dragOffsetX {0} |
| float | _dragOffsetY {0} |
| bool | _hitTestInstalled {false} |
| bool | _fingerDown {false} |
| SDL_FingerID | _finger {0} |
| unsigned | _penButtons {0} |
| std::vector< std::string > | _droppedFiles {} |
| Protected Attributes inherited from psychic_ui::SystemWindow | |
| 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} |
Friends | |
| class | SDL3Application |
Additional Inherited Members | |
| Public Types inherited from psychic_ui::SystemWindow | |
| using | GLProc = void (*)() |
Shows a Psychic UI Window in an SDL3 window that has an OpenGL context.
SDL3Application makes one for each window it opens. A host application with its own SDL window, GL context and loop embeds Psychic UI the same way:
auto ui = std::make_shared<MyWindow>();
psychic_ui::SDL3SystemWindow adapter(ui, sdlWindow, glContext);
while (running) {
SDL_Event event;
while (SDL_PollEvent(&event)) {
adapter.handleEvent(event); // false when the event isn't for this window
}
adapter.render(); // makes the context current and draws
SDL_GL_SwapWindow(sdlWindow);
}
A host that waits for events while nothing changes asks the window when to draw again (Window::untilNextFrame), as SDL3Application::run does.
For custom title bars (Window::addDragArea) and the resize borders of an undecorated window, also call adapter.installHitTest(), which replaces the window's SDL hit test.
The adapter never creates, shows, destroys or polls anything of the host's: destroy it before the SDL window and the GL context.
| psychic_ui::SDL3SystemWindow::SDL3SystemWindow | ( | std::shared_ptr< Window > | window, |
| SDL_Window * | sdlWindow, | ||
| SDL_GLContext | glContext ) |
| glContext | The window's context, made current to draw; nullptr when the host makes a context current itself before render() |
|
nodiscardoverridevirtual |
SDL_GetSystemTheme. handleEvent passes SDL_EVENT_SYSTEM_THEME_CHANGED on to the window, whatever window the event names (it names none). Virtual so that tests can make up a system.
Reimplemented from psychic_ui::SystemWindow.
|
nodiscardoverridevirtual |
SDL's clock, which times its events
Reimplemented from psychic_ui::SystemWindow.
|
nodiscardoverridevirtual |
The system clipboard's text, in UTF-8. Without a system clipboard (this default), a clipboard that only lives in this system window.
Reimplemented from psychic_ui::SystemWindow.
|
nodiscardoverridevirtual |
Implements psychic_ui::SystemWindow.
|
nodiscardoverridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Address of an OpenGL function in this window's context, which Skia builds its GL interface from
Implements psychic_ui::SystemWindow.
| bool psychic_ui::SDL3SystemWindow::handleEvent | ( | const SDL_Event & | event | ) |
Translates an SDL event into the window's events
| SDL_HitTestResult psychic_ui::SDL3SystemWindow::hitTest | ( | int | x, |
| int | y ) |
What a point of the window (window coordinates) is for: moving the window on the Window's drag areas, resizing it on the borders of an undecorated resizable window, otherwise normal input
| bool psychic_ui::SDL3SystemWindow::installHitTest | ( | ) |
Lets SDL ask hitTest where presses go, so the window manager or compositor moves the window from its drag areas and resizes it from the borders of an undecorated window, on Wayland too
|
overridevirtual |
Draws the window into its framebuffer, without presenting it.
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Reimplemented from psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
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 from psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Reimplemented from psychic_ui::SystemWindow.
|
overridevirtual |
Implements psychic_ui::SystemWindow.
|
overridevirtual |
Reimplemented from psychic_ui::SystemWindow.
|
nodiscardoverridevirtual |
Whether the window can be moved from inside it, by Window::isDragArea or startDrag()
Reimplemented from psychic_ui::SystemWindow.
|
nodiscardprotectedvirtual |
What kind of touch device sent finger events: only touch screens (direct) are followed, trackpads also move the mouse. Virtual so that tests can make up touch screens.
|
overridevirtual |
Pushes an event of wakeEventType(), which ends an SDL_WaitEvent: a host that waits for events draws when it gets one (the adapter ignores it)
Reimplemented from psychic_ui::SystemWindow.
|
static |
The event type wake pushes, registered with SDL on first use
|
protected |
System cursors, indexed by Cursor
|
protected |
Where the window was grabbed, relative to its position, while dragging it ourselves
|
protected |
Files of the drop in progress, dispatched together when it completes
|
protected |
The finger the window follows (the first one down on a touch screen), while one is down
|
protected |
Buttons held with the pen, mouse style (the tip is the left button)