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"
85 const char*
const* filelist,
126 std::function<void(
const char*
const* filelist,
int filter)>;
179 std::span<const DialogFileFilter> filters = {},
180 StringParam default_location = {},
181 bool allow_many =
false)
183 SDL_ShowOpenFileDialog(callback,
240 std::span<const DialogFileFilter> filters = {},
241 StringParam default_location = {},
242 bool allow_many =
false)
244 using Wrapper = CallbackWrapper<DialogFileCB>;
246 Wrapper::Wrap(std::move(callback)),
249 std::move(default_location),
302 std::span<const DialogFileFilter> filters = {},
303 StringParam default_location = {})
305 SDL_ShowSaveFileDialog(callback,
359 std::span<const DialogFileFilter> filters = {},
360 StringParam default_location = {})
362 using Wrapper = CallbackWrapper<DialogFileCB>;
364 Wrapper::Wrap(std::move(callback)),
367 std::move(default_location));
416 StringParam default_location = {},
417 bool allow_many =
false)
419 SDL_ShowOpenFolderDialog(
420 callback, userdata, window, default_location, allow_many);
466 StringParam default_location = {},
467 bool allow_many =
false)
469 using Wrapper = CallbackWrapper<DialogFileCB>;
471 Wrapper::Wrap(std::move(callback)),
473 std::move(default_location),
490 SDL_FILEDIALOG_OPENFILE;
493 SDL_FILEDIALOG_SAVEFILE;
496 SDL_FILEDIALOG_OPENFOLDER;
548 SDL_ShowFileDialogWithProperties(type, callback, userdata, props);
600 type, &Wrapper::CallOnce, Wrapper::Wrap(std::move(callback)), props);
603namespace prop::FileDialog {
605constexpr auto FILTERS_POINTER = SDL_PROP_FILE_DIALOG_FILTERS_POINTER;
607constexpr auto NFILTERS_NUMBER = SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER;
609constexpr auto WINDOW_POINTER = SDL_PROP_FILE_DIALOG_WINDOW_POINTER;
611constexpr auto LOCATION_STRING = SDL_PROP_FILE_DIALOG_LOCATION_STRING;
613constexpr auto MANY_BOOLEAN = SDL_PROP_FILE_DIALOG_MANY_BOOLEAN;
615constexpr auto TITLE_STRING = SDL_PROP_FILE_DIALOG_TITLE_STRING;
617constexpr auto ACCEPT_STRING = SDL_PROP_FILE_DIALOG_ACCEPT_STRING;
619constexpr auto CANCEL_STRING = SDL_PROP_FILE_DIALOG_CANCEL_STRING;
void ShowFileDialogWithProperties(FileDialogType type, DialogFileCallback callback, void *userdata, PropertiesParam props)
Create and launch a file dialog with the specified properties.
Definition: SDL3pp_dialog.h:543
void ShowOpenFileDialog(DialogFileCallback callback, void *userdata, WindowParam 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:176
SDL_FileDialogType FileDialogType
Various types of file dialogs.
Definition: SDL3pp_dialog.h:487
std::function< void(const char *const *filelist, int filter)> DialogFileCB
Callback used by file dialog functions.
Definition: SDL3pp_dialog.h:126
constexpr FileDialogType FILEDIALOG_OPENFOLDER
OPENFOLDER.
Definition: SDL3pp_dialog.h:495
void ShowSaveFileDialog(DialogFileCallback callback, void *userdata, WindowParam 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:299
constexpr FileDialogType FILEDIALOG_OPENFILE
OPENFILE.
Definition: SDL3pp_dialog.h:489
void(SDLCALL *)(void *userdata, const char *const *filelist, int filter) DialogFileCallback
Callback used by file dialog functions.
Definition: SDL3pp_dialog.h:86
constexpr FileDialogType FILEDIALOG_SAVEFILE
SAVEFILE.
Definition: SDL3pp_dialog.h:492
SDL_DialogFileFilter DialogFileFilter
An entry for filters for file dialogs.
Definition: SDL3pp_dialog.h:45
void ShowOpenFolderDialog(DialogFileCallback callback, void *userdata, WindowParam 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:413
SDL_PropertiesID PropertiesID
Alias to raw representation for Properties.
Definition: SDL3pp_properties.h:45
Main include header for the SDL3pp library.
Definition: SDL3pp_callbackWrapper.h:20
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:52
Safely wrap Window for non owning parameters.
Definition: SDL3pp_video.h:54