GUI
Text and Rich Content
NAppGUI separates lightweight display widgets from richer document-style surfaces. Labels and image views are
small owner-drawn controls, TextView offers formatted text editing and RTF support, and WebView
wraps an optional embedded browser backend.
Relevant Source Files
Labels and Image Views
Label is more than static text. It supports click handling, explicit width, dynamic sizing from text,
custom font, hover style, normal/hover foreground and background colors, multiline mode, alignment, and ellipsis trimming.
ImageView is the image counterpart: explicit view size, scale mode, click handling, and an extra
OnOverDraw hook for custom painting on top of the image. Both are implemented on top of the custom-view infrastructure,
not as thin wrappers around native OS label/image widgets.
TextView as The Rich Text Surface
TextView exposes a document-like API rather than a plain edit API. It supports formatted append/write calls,
caret-positioned writing, RTF import from a Stream, font family/size/style selection, text and paragraph colors,
alignment, line spacing, before/after paragraph spacing, selection control, deletion, clipboard commands, caret scrolling,
editability, visible scrollbars, and wrapping.
The styling model is incremental: configure attributes, then apply them either to all text or the current selection via
textview_apply_all(...) or textview_apply_select(...).
WebView Has a Stable API but Conditional Backend
The public API is intentionally small: create the view, track focus, set size, navigate, and go back/forward. That API exists on every platform, but the real browser implementation depends on build-time capability.
In this checkout the backend matrix is: WKWebView on macOS when web support is enabled,
WebView2 on Windows, and WebKitGTK on GTK. Without support, the native wrapper still exists but falls back to a stub control.
Fonts, Images, and Resource Packs
The rich-content widgets rely heavily on draw2d. Fonts come from font.h,
images from image.h, and many text/image properties can be loaded indirectly through GUI resource packs.
That is why APIs such as label text, button text, popup/list element text, and image-bearing controls integrate cleanly
with the gui_respack(...) resource model.
At the page-author level, the useful distinction is simple: use labels and image views for lightweight, custom-drawn display; use text views for formatted editable content; use web views when the platform/browser dependencies are acceptable.