1#ifndef SDL3PP_DIALOG_H_
2#define SDL3PP_DIALOG_H_
4#include <SDL3/SDL_dialog.h>
5#include "SDL3pp_properties.h"
6#include "SDL3pp_stdinc.h"
7#include "SDL3pp_video.h"
181 std::span<const DialogFileFilter> filters = {},
182 StringParam default_location = {},
183 bool allow_many =
false)
185 SDL_ShowOpenFileDialog(callback,
243 std::span<const DialogFileFilter> filters = {},
244 StringParam default_location = {},
245 bool allow_many =
false)
247 using Wrapper = CallbackWrapper<DialogFileCB>;
249 Wrapper::Wrap(std::move(callback)),
252 std::move(default_location),
306 std::span<const DialogFileFilter> filters = {},
307 StringParam default_location = {})
309 SDL_ShowSaveFileDialog(callback,
364 std::span<const DialogFileFilter> filters = {},
365 StringParam default_location = {})
367 using Wrapper = CallbackWrapper<DialogFileCB>;
369 Wrapper::Wrap(std::move(callback)),
372 std::move(default_location));
422 StringParam default_location = {},
423 bool allow_many =
false)
425 SDL_ShowOpenFolderDialog(
426 callback, userdata, window.get(), default_location, allow_many);
473 StringParam default_location = {},
474 bool allow_many =
false)
476 using Wrapper = CallbackWrapper<DialogFileCB>;
478 Wrapper::Wrap(std::move(callback)),
480 std::move(default_location),
497 SDL_FILEDIALOG_OPENFILE;
500 SDL_FILEDIALOG_SAVEFILE;
503 SDL_FILEDIALOG_OPENFOLDER;
557 SDL_ShowFileDialogWithProperties(type, callback, userdata, props.
get());
612 type, &Wrapper::CallOnce, Wrapper::Wrap(std::move(callback)), props);
615namespace prop::FileDialog {
617constexpr auto FILTERS_POINTER = SDL_PROP_FILE_DIALOG_FILTERS_POINTER;
619constexpr auto NFILTERS_NUMBER = SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER;
621constexpr auto WINDOW_POINTER = SDL_PROP_FILE_DIALOG_WINDOW_POINTER;
623constexpr auto LOCATION_STRING = SDL_PROP_FILE_DIALOG_LOCATION_STRING;
625constexpr auto MANY_BOOLEAN = SDL_PROP_FILE_DIALOG_MANY_BOOLEAN;
627constexpr auto TITLE_STRING = SDL_PROP_FILE_DIALOG_TITLE_STRING;
629constexpr auto ACCEPT_STRING = SDL_PROP_FILE_DIALOG_ACCEPT_STRING;
631constexpr auto CANCEL_STRING = SDL_PROP_FILE_DIALOG_CANCEL_STRING;
A optional reference to resource.
Definition SDL3pp_resource.h:88
constexpr T get() const
Return contained resource;.
Definition SDL3pp_resource.h:57
SDL_FileDialogType FileDialogType
Various types of file dialogs.
Definition SDL3pp_dialog.h:494
SDL_DialogFileCallback DialogFileCallback
Callback used by file dialog functions.
Definition SDL3pp_dialog.h:88
std::function< void(const char *const *, int)> DialogFileCB
Callback used by file dialog functions.
Definition SDL3pp_dialog.h:127
constexpr FileDialogType FILEDIALOG_OPENFOLDER
OPENFOLDER.
Definition SDL3pp_dialog.h:502
void ShowSaveFileDialog(DialogFileCallback callback, void *userdata, OptionalWindow window={}, std::span< const DialogFileFilter > filters={}, StringParam default_location={})
Displays a dialog that lets the user choose a new or existing file on their filesystem.
Definition SDL3pp_dialog.h:303
void ShowFileDialogWithProperties(FileDialogType type, DialogFileCallback callback, void *userdata, PropertiesBase &props)
Create and launch a file dialog with the specified properties.
Definition SDL3pp_dialog.h:552
constexpr FileDialogType FILEDIALOG_OPENFILE
OPENFILE.
Definition SDL3pp_dialog.h:496
void ShowOpenFolderDialog(DialogFileCallback callback, void *userdata, OptionalWindow window={}, StringParam default_location={}, bool allow_many=false)
Displays a dialog that lets the user select a folder on their filesystem.
Definition SDL3pp_dialog.h:419
constexpr FileDialogType FILEDIALOG_SAVEFILE
SAVEFILE.
Definition SDL3pp_dialog.h:499
SDL_DialogFileFilter DialogFileFilter
An entry for filters for file dialogs.
Definition SDL3pp_dialog.h:48
void ShowOpenFileDialog(DialogFileCallback callback, void *userdata, OptionalWindow window={}, std::span< const DialogFileFilter > filters={}, StringParam default_location={}, bool allow_many=false)
Displays a dialog that lets the user select a file on their filesystem.
Definition SDL3pp_dialog.h:178
the main namespace where all SDL3pp public functions and types live
Definition SDL3pp_assert.h:7
Definition SDL3pp_callbackWrapper.h:66
Wrap properties id.
Definition SDL3pp_properties.h:203
Handle to a non owned properties.
Definition SDL3pp_properties.h:693