Asynchronous browser-owned file access; the host window must outlive this object. More...
#include "donner/editor/BrowserFileDialog.h"
Classes | |
| struct | Result |
| Owning result consumed by the editor thread. More... | |
Public Types | |
| enum class | Operation { Open , ChooseSaveTarget , Write , ChooseExportTarget } |
| Browser operation whose completion is being delivered. | |
| enum class | Status { Success , Cancelled , Failed , Downloaded } |
| Completion outcome, with cancellation distinct from failure. | |
Public Member Functions | |
| BrowserFileDialog (std::function< void()> wake) | |
| Register a thread-safe wake callback for completed browser requests. | |
| BrowserFileDialog (const BrowserFileDialog &)=delete | |
| BrowserFileDialog & | operator= (const BrowserFileDialog &)=delete |
| bool | pending () const |
| Whether a picker/write is running or its completion still awaits consumption. | |
| bool | open () |
| Request one SVG through the browser's native picker. | |
| void | acceptOpen (bool accepted) |
| Adopt the selected open handle only after the editor accepts its SVG contents. | |
| bool | chooseSaveTarget (std::string_view name, bool saveAs, bool replaceBacking=true) |
| Choose a destination before waiting for document synchronization. | |
| bool | write (std::string_view source) |
| Write the supplied immutable source to the previously selected destination. | |
| std::optional< Result > | takeResult () |
| Consume a completed request, if any. | |
Static Public Member Functions | |
| static bool | available () |
| Whether this platform uses browser file pickers. | |
| static void | reportError (std::string_view message) |
| Show a file-operation error using the browser's dialog surface. | |
Asynchronous browser-owned file access; the host window must outlive this object.
| struct donner::editor::BrowserFileDialog::Result |
|
explicit |
Register a thread-safe wake callback for completed browser requests.
| wake | Nonblocking callback; its captured host must outlive this object. |
| void donner::editor::BrowserFileDialog::acceptOpen | ( | bool | accepted | ) |
Adopt the selected open handle only after the editor accepts its SVG contents.
| accepted | Whether parsing and loading succeeded. |
| bool donner::editor::BrowserFileDialog::chooseSaveTarget | ( | std::string_view | name, |
| bool | saveAs, | ||
| bool | replaceBacking = true ) |
Choose a destination before waiting for document synchronization.
| name | Suggested filename. |
| saveAs | Always prompt for a new destination. |
| replaceBacking | Whether a successful write becomes the document save destination. |
|
static |
Show a file-operation error using the browser's dialog surface.
| message | User-facing failure detail. |
| bool donner::editor::BrowserFileDialog::write | ( | std::string_view | source | ) |
Write the supplied immutable source to the previously selected destination.
| source | Exact SVG bytes to write. |