GGFiles class
#include <GGUI/Public/UINotices.h>
GGFiles: the platform file dialog, requested now and answered later. Thread-safe.
The platform layer provides the backend (SetBackend) and reports results (Answer). Results are delivered where it is safe: to a document at its next update, or to non-document callers when the host calls RunAnswers.
Public types
- using BackendFn = void(*)(void*context, const FileRequest&request)
- Opens the native dialog. Must eventually call Answer with the request's ID.
Public functions
- void SetBackend(BackendFn open, void* context)
- The platform's dialog. Without one, Open does nothing.
- auto HasBackend() const -> bool
- Whether a backend is set.
- void Open(const FileDialogProps& props, FileChoiceFn chosen)
- Open a dialog, for non-document callers:
chosenruns from RunAnswers. Nothing without a backend. - void Open(const FileDialogProps& props, FileChoiceFn chosen, const UIContext* asker)
- Open a dialog for a document:
chosenruns in that document's next update after the answer arrives. Nothing without a backend. - void Answer(uint32_t id, std::vector<std::string> paths)
- Report a result. Empty
pathsmeans cancelled. - void RunAnswers()
- Deliver results to non-document callers. Called by the host.
- void RunAnswersFor(const UIContext* asker)
- Deliver results to
asker. Called from its update. - void Forget(const UIContext* asker)
- Drop
asker'spending requests. Called when a document is destroyed.