Define custom Cardinal API for async dialogs

Closes #51

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2021-12-11 21:53:50 +00:00
parent b6ac2766dc
commit ce64476fa4
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
6 changed files with 242 additions and 8 deletions

View file

@ -39,3 +39,23 @@
#endif
#undef PRIVATE_WAS_DEFINED
// Cardinal specific API
#include <functional>
#define USING_CARDINAL_NOT_RACK
// opens a file browser, startDir and title can be null
// action is always triggered on close (path can be null), must be freed if not null
void async_dialog_filebrowser(bool saving, const char* startDir, const char* title,
std::function<void(char* path)> action);
// opens a message dialog with only an "ok" button
void async_dialog_message(const char* message);
// opens a message dialog with "ok" and "cancel" buttons
// action is triggered if user presses "ok"
void async_dialog_message(const char* message, std::function<void()> action);
// opens a text input dialog, message and text can be null
// action is always triggered on close (newText can be null), must be freed if not null
void async_dialog_text_input(const char* message, const char* text, std::function<void(char* newText)> action);