48 std::optional<color4b>
ReadScreenPixel(
int2 screenPos)
override {
return m_os.ReadScreenPixel(screenPos); }
77 std::unique_ptr<State> m_state;
78 uint32_t m_focusChanges = 0;
A graphics backend: the device, the window contexts that render the GUI's windows,...
Definition gui_graphics_context.h:60
virtual void SetGraphicsContext(GraphicsContext *graphicsContext)
The graphics context the windows are made for and painted with (during an OS live resize).
Definition gui_window_backend.h:247
IWindowBackend()
Definition gui_window_backend.h:107
A window's rendering state: made by GraphicsContext::CreateWindowContext for each OS window,...
Definition gui_window_backend.h:72
bool TakeCloseRequest(OSWindowHandle window) override
Whether the OS asked to close a WindowFlags::ConfirmClose window since last asked.
Definition gui_image_window_backend.h:49
MouseButtons GetMouseButtons() override
The mouse buttons held down, wherever the mouse is (SDL: as of the last PollEvents).
void DetachWindowContext(OSWindowHandle window) override
Clears the context pointer stored in the OS window, so PollEvents' cleanup callback gets nullptr inst...
bool IsImageWindow(OSWindowHandle window) const
True when window is one of this backend's image windows.
IntRect GetWindowPixelRect(OSWindowHandle window) override
The window's render target: OS position (for OS compositing) and size in physical pixels.
int2 GetWindowPos(OSWindowHandle window) override
The client area's top-left in screen pixels.
void SetFocus(OSWindowHandle window)
The image window with keyboard focus, reported as the active window.
OSWindowHandle CreateWindow(std::string_view title, int2 size, WindowFlags windowFlags, OSWindowHandle parentOSHandle) override
Creates a window whose client area is size pixels, placed by the OS.
uint32_t GetFocusChangeCount() const override
Goes up whenever keyboard focus moves between windows, or to or from another application; open popups...
Definition gui_image_window_backend.h:45
int2 GetScreenMousePos() override
The mouse position in screen pixels (SDL: as of the last PollEvents).
float GetWindowDisplayScale(OSWindowHandle window) override
The UI scale the OS asks for in this window: pixel density times the monitor's content scale (1....
bool SetWindowRect(OSWindowHandle window, const IntRect &clientRect) override
Moves and resizes the window so its client area is clientRect (screen pixels); the backend accounts f...
void BringToFront(OSWindowHandle window) override
Raises the window above the others and asks the OS for the input focus.
int GetMonitorFromWindow(OSWindowHandle window) const override
Index into GetMonitors of the window's monitor; -1 for an unknown window.
int GetMonitorAt(int2 pos) const override
Index into GetMonitors of the monitor holding the screen point pos; 0 (the primary) when no monitor h...
std::optional< color4b > ReadScreenPixel(int2 screenPos) override
The color of a screen pixel, anywhere on the desktop (an eyedropper); nothing where the platform can'...
Definition gui_image_window_backend.h:48
OSWindowHandle CreateWindow(std::string_view title, IntRect rect, WindowFlags windowFlags, OSWindowHandle parentOSHandle) override
Creates a window whose client area is rect (screen pixels); otherwise as the size overload.
void SwapBuffers(OSWindowHandle window) override
Presents for a graphics API that swaps through the window (OpenGL).
std::vector< MonitorInfo > GetMonitors() const override
Every monitor, the primary first.
void SetGraphicsContext(GraphicsContext *graphicsContext) override
The graphics context the windows are made for and painted with (during an OS live resize).
Definition gui_image_window_backend.h:33
std::string GetPreferredLanguage() const override
The user's preferred language as a BCP 47 tag ("ja", "en-US"), or empty when the platform doesn't say...
void SetCursor(MouseCursor cursor) override
Shows the system cursor for that shape; MouseCursor::None hides the cursor.
bool IsWindow(OSWindowHandle window) override
True while the handle is a live window of this backend; false once it was destroyed (by code or the u...
~ImageWindowBackend() override
void SetPointer(OSWindowHandle window, int2 screenPos, MouseButtons buttons)
The pointer is over an image window, at this screen position with these buttons held; it is then the ...
IntRect GetWindowRect(OSWindowHandle window) override
Client area in pixels; {0,0,0,0} while minimized.
OSWindowHandle GetWindowUnderMouse() override
The backend's window under the mouse, or nullptr.
void PollEvents(std::function< void(OSWindowHandle, IWindowContext *)> cleanup) override
Handles the OS's pending events, delivering input to the attached handlers.
void AttachInputHandlerToWindow(OSWindowHandle window, IPlatformInputHandler *inputHandler) override
Where the window's input goes (see IPlatformInputHandler); not owned, nullptr for none.
ImageWindowBackend(IWindowBackend &osBackend)
int32_t GetCursorSize() const override
The OS mouse cursor's size in pixels (its accessibility size at the display's scale),...
void SetWindowVisible(OSWindowHandle window, bool visible) override
Shows or hides the window; hiding doesn't destroy it.
void SetWindowMode(OSWindowHandle window, WindowMode mode) override
Sets the window's state: minimized, maximized, restored or fullscreen.
Definition gui_image_window_backend.h:62
int2 GetWindowSize(OSWindowHandle window) override
The client area's size in pixels; {0,0} while minimized.
OSWindowHandle GetActiveWindow() override
The window with the keyboard focus, or nullptr when none of the backend's windows has it.
void AttachContextToWindow(OSWindowHandle window, IWindowContext *context) override
Stores the window's context (not owned), for GetWindowContext, for the ID passed with the window's in...
void SetTextInputArea(OSWindowHandle window, IntRect rect) override
Where text is being typed in the window (window coordinates), so the IME places its candidate list ne...
void * GetNativeHandle(OSWindowHandle window) override
The OS's own window handle, passed to GraphicsContext::CreateWindowContext (HWND on Windows,...
uint32_t GetTicks() const override
A millisecond clock (SDL: since SDL started).
WindowMode GetWindowMode(OSWindowHandle window) const override
The window's state as the OS has it now; WindowMode::Normal by default.
Definition gui_image_window_backend.h:63
IWindowContext * GetWindowContext(OSWindowHandle window) override
The context attached with AttachContextToWindow, or nullptr.
bool DestroyWindow(OSWindowHandle window) override
Queues the window for destruction: the next PollEvents passes its context to cleanup,...
MouseCursor
Mouse cursor shown over an element (CSS: cursor).
Definition gui_style.h:478
WindowFlags
How an OS window is made and behaves (IWindowBackend::CreateWindow); flags combine with |.
Definition gui_window_flags.h:12
WindowMode
A window's state (IWindowBackend::SetWindowMode). Any window can go fullscreen.
Definition gui_window_backend.h:60
void * OSWindowHandle
An OS window, opaque; what it points to is up to the window backend.
Definition gui_window_backend.h:37
@ Normal
as placed (restored)
Definition gui_window_backend.h:61
Definition gui_logging.h:24
Definition gui_base_types.h:407
Integer 2D vector.
Definition gui_base_types.h:19