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)>;
181 std::span<const DialogFileFilter> filters = {},
182 StringParam default_location = {},
183 bool allow_many =
false)
185 SDL_ShowOpenFileDialog(callback,
244 std::span<const DialogFileFilter> filters = {},
245 StringParam default_location = {},
246 bool allow_many =
false)
248 using Wrapper = CallbackWrapper<DialogFileCB>;
250 Wrapper::Wrap(std::move(callback)),
253 std::move(default_location),
306 std::span<const DialogFileFilter> filters = {},
307 StringParam default_location = {})
309 SDL_ShowSaveFileDialog(callback,
363 std::span<const DialogFileFilter> filters = {},
364 StringParam default_location = {})
366 using Wrapper = CallbackWrapper<DialogFileCB>;
368 Wrapper::Wrap(std::move(callback)),
371 std::move(default_location));
420 StringParam default_location = {},
421 bool allow_many =
false)
423 SDL_ShowOpenFolderDialog(
424 callback, userdata, window, default_location, allow_many);
470 StringParam default_location = {},
471 bool allow_many =
false)
473 using Wrapper = CallbackWrapper<DialogFileCB>;
475 Wrapper::Wrap(std::move(callback)),
477 std::move(default_location),
494 SDL_FILEDIALOG_OPENFILE;
497 SDL_FILEDIALOG_SAVEFILE;
500 SDL_FILEDIALOG_OPENFOLDER;
552 SDL_ShowFileDialogWithProperties(type, callback, userdata, props);
604 type, &Wrapper::CallOnce, Wrapper::Wrap(std::move(callback)), props);
607namespace prop::FileDialog {
609constexpr auto FILTERS_POINTER = SDL_PROP_FILE_DIALOG_FILTERS_POINTER;
611constexpr auto NFILTERS_NUMBER = SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER;
613constexpr auto WINDOW_POINTER = SDL_PROP_FILE_DIALOG_WINDOW_POINTER;
615constexpr auto LOCATION_STRING = SDL_PROP_FILE_DIALOG_LOCATION_STRING;
617constexpr auto MANY_BOOLEAN = SDL_PROP_FILE_DIALOG_MANY_BOOLEAN;
619constexpr auto TITLE_STRING = SDL_PROP_FILE_DIALOG_TITLE_STRING;
621constexpr auto ACCEPT_STRING = SDL_PROP_FILE_DIALOG_ACCEPT_STRING;
623constexpr 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:547
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:178
SDL_FileDialogType FileDialogType
Various types of file dialogs.
Definition: SDL3pp_dialog.h:491
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:499
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:303
constexpr FileDialogType FILEDIALOG_OPENFILE
OPENFILE.
Definition: SDL3pp_dialog.h:493
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:496
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:417
SDL_PropertiesID PropertiesID
Alias to raw representation for Properties.
Definition: SDL3pp_properties.h:46
Main include header for the SDL3pp library.
Definition: SDL3pp_callbackWrapper.h:20
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:53
Safely wrap Window for non owning parameters.
Definition: SDL3pp_video.h:54