Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::editor::DialogPresenter Class Reference

Owns the editor's popup/modal state and renders the corresponding ImGui dialogs. More...

#include "donner/editor/DialogPresenter.h"

Public Member Functions

 DialogPresenter (std::string editorNoticeText, std::string editorBuildInfo=std::string())
 Create modal state with the host's notice and build information.
void requestOpenFile (const std::optional< std::string > &currentFilePath)
 Queue the Open SVG dialog with an initial path.
void requestSaveFile (const std::optional< std::string > &currentFilePath, std::string error=std::string())
 Queue the Save SVG dialog with an initial path and optional error.
void requestAbout ()
 Queue the About dialog for the next presentation pass.
void render (const std::function< bool(std::string_view, std::string *)> &tryOpenFile, const std::function< bool(std::string_view, std::string *)> &trySaveFile)
 Draw requested dialogs and invoke host callbacks for accepted paths.
void setOpenFileError (std::string error)
 Replace the error shown by the Open SVG dialog.
void clearOpenFileError ()
 Clear the Open SVG dialog error.
void setSaveFileError (std::string error)
 Replace the error shown by the Save SVG dialog.
void clearSaveFileError ()
 Clear the Save SVG dialog error.
bool openFileModalRequested () const
 Whether an Open SVG modal has been requested but not yet opened by render().
bool saveFileModalRequested () const
 Whether a Save SVG modal has been requested but not yet opened by render().
void consumeOpenFileModalRequest ()
 Consume a pending Open SVG request without showing the ImGui modal. Used when a native OS dialog handles the interaction instead.
void consumeSaveFileModalRequest ()
 Consume a pending Save SVG request without showing the ImGui modal. Used when a native OS dialog handles the interaction instead.
std::string pendingSaveFilePath () const
 The path pre-filled into the pending Save SVG request (the current file path, or the suggested export/save-as name). Empty when none was set.
bool aboutPopupRequested () const
 Whether the About modal has been requested but not yet opened by render().

Detailed Description

Owns the editor's popup/modal state and renders the corresponding ImGui dialogs.

Constructor & Destructor Documentation

◆ DialogPresenter()

donner::editor::DialogPresenter::DialogPresenter ( std::string editorNoticeText,
std::string editorBuildInfo = std::string() )
explicit

Create modal state with the host's notice and build information.

Parameters
editorNoticeTextThird-party notices shown in the Licenses dialog.
editorBuildInfoOptional version and commit lines.

Member Function Documentation

◆ render()

void donner::editor::DialogPresenter::render ( const std::function< bool(std::string_view, std::string *)> & tryOpenFile,
const std::function< bool(std::string_view, std::string *)> & trySaveFile )

Draw requested dialogs and invoke host callbacks for accepted paths.

Parameters
tryOpenFileAttempts an open and returns success; writes a failure message through its string pointer.
trySaveFileAttempts a save and returns success; writes a failure message through its string pointer.

◆ requestOpenFile()

void donner::editor::DialogPresenter::requestOpenFile ( const std::optional< std::string > & currentFilePath)

Queue the Open SVG dialog with an initial path.

Parameters
currentFilePathCurrent file path when available.

◆ requestSaveFile()

void donner::editor::DialogPresenter::requestSaveFile ( const std::optional< std::string > & currentFilePath,
std::string error = std::string() )

Queue the Save SVG dialog with an initial path and optional error.

Parameters
currentFilePathCurrent or suggested destination path.
errorInitial save error to display.

◆ setOpenFileError()

void donner::editor::DialogPresenter::setOpenFileError ( std::string error)

Replace the error shown by the Open SVG dialog.

Parameters
errorNew diagnostic text.

◆ setSaveFileError()

void donner::editor::DialogPresenter::setSaveFileError ( std::string error)

Replace the error shown by the Save SVG dialog.

Parameters
errorNew diagnostic text.

The documentation for this class was generated from the following file: