Search guides and the APICtrl K
  1. API reference
  2. Native GUI

gfx/native_editor.h

The native editor as a plugin format sees it: one object with a window in it, opened into whatever handle the host passes down.

#include <sonore/gfx/native_editor.h>
On this page

Design notes

What this adds over GenericEditor

GenericEditor is a Component. It has no window, no timer and no font, which is exactly why it can be tested by rendering into a Bitmap. This file is the part that cannot be tested that way: finding a typeface, making a real OS window, and keeping the two alive together for as long as the host wants an editor open.

Keeping them apart means the untestable part is small and dull. Everything with a rule in it -- which curve, which gesture, which pixel -- is on the other side of the line.

When there is no window backend

Win32, X11 and Cocoa each have one. Where none can run -- no display on Linux, an unsupported platform -- isAvailable() says so and unavailableReason() says why, so a wrapper can fall back to the webview and the fallback names its reason instead of the editor silently being a blank rectangle.

On Linux, "available" is decided TWICE: once at compile time, because <X11/Xlib.h> may not have been installed when the plugin was built, and once at runtime, because libX11.so.6 may not be on the machine that loads it. Both are real -- a build container is usually minimal and a Wayland-only session genuinely has no Xlib -- and both name themselves differently.

Types 3

A small window that shows a component and takes no input at all.

A tooltip is not a menu. A menu grabs the pointer because it has to hear the click that dismisses it; a tooltip that grabbed would stop the user reaching the very control it is describing, and on macOS taking key focus would pull it off the host every time one appeared.

So it is the same platform window with the grab turned off, and it exists as a separate class rather than a flag on PopupWindow because the two have nothing else in common -- no dismissal, no choice, no callback.

A GenericEditor with a window around it.

Owns the content, the attachments and the OS window. Non-copyable by construction: the window procedure holds a pointer to this object.

Aliases 1

Macros 1

↑↓ to move↵ to openEvery public name in the headers, and every guide