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
EditorWindow.h File Reference

EditorWindow - RAII wrapper around GLFW + OpenGL + Dear ImGui. Keeps the main binary thin by encapsulating everything that would otherwise be boilerplate: GLFW init, window creation, context current, glad loader, ImGui context, imgui_impl_glfw + imgui_impl_opengl3 setup, plus texture upload from a RendererBitmap. More...

#include <array>
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include "donner/base/Vector2.h"
#include "donner/svg/renderer/RendererInterface.h"
Include dependency graph for EditorWindow.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::gui::UiScaleConfig
 HiDPI settings derived from the native window/display scale. More...
struct  donner::editor::gui::EditorWindowOptions
struct  donner::editor::gui::EditorWindowFrameTiming
 Host-frame timing captured by EditorWindow. More...
struct  donner::editor::gui::EditorWindowFonts
 Fonts loaded into this window's ImGui context for the editor shell. More...
struct  donner::editor::gui::EditorWindowInputOverride
 ImGui input state to inject for deterministic editor replay. More...
class  donner::editor::gui::EditorWindow
 Initializes GLFW + GL + ImGui when constructed, tears everything down in the destructor. One instance per process - ImGui's global state means we can't easily have two at once. More...

Namespaces

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

Typedefs

using GLFWscrollfun = void (*)(GLFWwindow*, double, double)

Functions

UiScaleConfig donner::editor::gui::ComputeUiScaleConfig (int logicalWindowWidth, int framebufferWidth, double contentScaleX)
 Derive the editor's UI scaling from logical window size, framebuffer size, and the platform's content scale hint. Prefers the framebuffer/logical ratio when available.

Detailed Description

EditorWindow - RAII wrapper around GLFW + OpenGL + Dear ImGui. Keeps the main binary thin by encapsulating everything that would otherwise be boilerplate: GLFW init, window creation, context current, glad loader, ImGui context, imgui_impl_glfw + imgui_impl_opengl3 setup, plus texture upload from a RendererBitmap.

The class is intentionally narrow - it exposes only what the main binary needs:

  • construct/destruct (RAII handles cleanup)
  • shouldClose() / pollEvents() / waitEvents() / waitEventsTimeout() - event loop hooks
  • beginFrame() / endFrame() - ImGui frame bracketing + swap
  • uploadBitmap() - moves a CPU-side RGBA buffer into a GL texture (reuses the same texture ID across frames to avoid churn)
  • textureId() - exposes the current texture for ImGui::Image

Any code that wants to draw ImGui widgets happens between beginFrame() and endFrame() on the caller's side - this class doesn't own the widget tree, just the hosting surface.