Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
NativeWindowChrome.h File Reference

Native window chrome integration for the editor's title bar. More...

#include <optional>
#include <string>
Include dependency graph for NativeWindowChrome.h:

Classes

struct  donner::editor::WindowChromeState
 Inputs to the window title / chrome derivation. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

std::string donner::editor::ComposeWindowTitle (const WindowChromeState &state, bool showEditedDotInText)
 Compose the window title-bar text.
bool donner::editor::NativeWindowChromeAvailable ()
 Whether this platform/build drives native title-bar chrome (the edited dot and proxy icon). True only on macOS.
void donner::editor::ApplyNativeWindowChrome (GLFWwindow *window, const WindowChromeState &state)
 Push the document's edited state and file identity into the native title bar.

Detailed Description

Native window chrome integration for the editor's title bar.

Two concerns live here:

  1. ComposeWindowTitle - pure derivation of the title-bar text from the open file and unsaved-changes state. Testable headlessly.
  2. The platform hooks - on macOS these drive the native title bar's edited "dot" (setDocumentEdited:) and proxy icon (setRepresentedURL:), so the editor behaves like a real Mac app. Other platforms provide no-op stubs.

Function Documentation

◆ ApplyNativeWindowChrome()

void donner::editor::ApplyNativeWindowChrome ( GLFWwindow * window,
const WindowChromeState & state )

Push the document's edited state and file identity into the native title bar.

On macOS this sets the window's documentEdited flag (the close-button dot) and representedURL (the draggable proxy icon). No-op elsewhere, or when window is null.

Parameters
windowGLFW window backing the editor.
stateCurrent document/edited state. A missing or non-existent file path clears the proxy icon.

◆ ComposeWindowTitle()

std::string donner::editor::ComposeWindowTitle ( const WindowChromeState & state,
bool showEditedDotInText )
nodiscard

Compose the window title-bar text.

Parameters
stateCurrent document/edited state.
showEditedDotInTextWhen true, an unsaved document is prefixed with a bullet ("● ") in the text itself. Callers pass false on platforms that show the edited state natively (macOS), where the dot is rendered by the OS via setDocumentEdited: instead.
Returns
Title such as "diagram.svg - Donner SVG Editor" or, for an unsaved untitled buffer with showEditedDotInText, "● untitled - Donner SVG Editor".