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

Platform-native file open/save dialogs. On macOS these present NSOpenPanel / NSSavePanel with a UTType filter for .svg, seeded from a remembered default directory, and register chosen files with the OS recent-documents list. On other platforms the functions report unavailable so callers fall back to the in-editor ImGui modal. More...

#include <optional>
#include <string>
#include <vector>
#include "donner/editor/FileDialogState.h"
Include dependency graph for NativeFileDialog.h:

Classes

struct  donner::editor::NativeOpenDialogRequest
 Parameters for a native open dialog. More...
struct  donner::editor::NativeSaveDialogRequest
 Parameters for a native save dialog. More...

Namespaces

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

Functions

bool donner::editor::NativeFileDialogAvailable ()
 Whether native file dialogs are available on this platform/build.
std::optional< std::string > donner::editor::ShowNativeOpenFileDialog (GLFWwindow *parent, const NativeOpenDialogRequest &request)
 Present a native modal open dialog.
std::optional< std::string > donner::editor::ShowNativeSaveFileDialog (GLFWwindow *parent, const NativeSaveDialogRequest &request)
 Present a native modal save dialog.
void donner::editor::NoteNativeRecentDocument (const std::string &path)
 Register path with the OS recent-documents list (macOS NSDocumentController noteNewRecentDocumentURL:). No-op where native dialogs are unavailable or for empty paths.

Detailed Description

Platform-native file open/save dialogs. On macOS these present NSOpenPanel / NSSavePanel with a UTType filter for .svg, seeded from a remembered default directory, and register chosen files with the OS recent-documents list. On other platforms the functions report unavailable so callers fall back to the in-editor ImGui modal.

Function Documentation

◆ NativeFileDialogAvailable()

bool donner::editor::NativeFileDialogAvailable ( )
nodiscard

Whether native file dialogs are available on this platform/build.

True only on macOS; other platforms return false and callers should keep using the ImGui path-entry modal.

◆ ShowNativeOpenFileDialog()

std::optional< std::string > donner::editor::ShowNativeOpenFileDialog ( GLFWwindow * parent,
const NativeOpenDialogRequest & request )
nodiscard

Present a native modal open dialog.

Parameters
parentOwning window (may be nullptr; used for association).
requestDialog configuration.
Returns
Absolute path of the chosen file, or std::nullopt if the user cancelled or native dialogs are unavailable.

◆ ShowNativeSaveFileDialog()

std::optional< std::string > donner::editor::ShowNativeSaveFileDialog ( GLFWwindow * parent,
const NativeSaveDialogRequest & request )
nodiscard

Present a native modal save dialog.

Parameters
parentOwning window (may be nullptr; used for association).
requestDialog configuration.
Returns
Absolute path chosen for saving, or std::nullopt if the user cancelled or native dialogs are unavailable.