Native window chrome integration for the editor's title bar.
More...
#include <optional>
#include <string>
Native window chrome integration for the editor's title bar.
Two concerns live here:
- ComposeWindowTitle - pure derivation of the title-bar text from the open file and unsaved-changes state. Testable headlessly.
- 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.
◆ 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
-
| window | GLFW window backing the editor. |
| state | Current 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
-
| state | Current document/edited state. |
| showEditedDotInText | When 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".