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"
177 std::span<const DialogFileFilter> filters = {},
178 StringParam default_location = {},
179 bool allow_many =
false)
181 SDL_ShowOpenFileDialog(callback,
239 std::span<const DialogFileFilter> filters = {},
240 StringParam default_location = {},
241 bool allow_many =
false)
243 using Wrapper = CallbackWrapper<DialogFileCB>;
245 Wrapper::Wrap(std::move(callback)),
248 std::move(default_location),
302 std::span<const DialogFileFilter> filters = {},
303 StringParam default_location = {})
305 SDL_ShowSaveFileDialog(callback,
360 std::span<const DialogFileFilter> filters = {},
361 StringParam default_location = {})
363 using Wrapper = CallbackWrapper<DialogFileCB>;
365 Wrapper::Wrap(std::move(callback)),
368 std::move(default_location));
418 StringParam default_location = {},
419 bool allow_many =
false)
421 SDL_ShowOpenFolderDialog(
422 callback, userdata, window, default_location, allow_many);
469 StringParam default_location = {},
470 bool allow_many =
false)
472 using Wrapper = CallbackWrapper<DialogFileCB>;
474 Wrapper::Wrap(std::move(callback)),
476 std::move(default_location),
493 SDL_FILEDIALOG_OPENFILE;
496 SDL_FILEDIALOG_SAVEFILE;
499 SDL_FILEDIALOG_OPENFOLDER;
553 SDL_ShowFileDialogWithProperties(type, callback, userdata, props);
607 type, &Wrapper::CallOnce, Wrapper::Wrap(std::move(callback)), props);
610namespace prop::FileDialog {
612constexpr auto FILTERS_POINTER = SDL_PROP_FILE_DIALOG_FILTERS_POINTER;
614constexpr auto NFILTERS_NUMBER = SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER;
616constexpr auto WINDOW_POINTER = SDL_PROP_FILE_DIALOG_WINDOW_POINTER;
618constexpr auto LOCATION_STRING = SDL_PROP_FILE_DIALOG_LOCATION_STRING;
620constexpr auto MANY_BOOLEAN = SDL_PROP_FILE_DIALOG_MANY_BOOLEAN;
622constexpr auto TITLE_STRING = SDL_PROP_FILE_DIALOG_TITLE_STRING;
624constexpr auto ACCEPT_STRING = SDL_PROP_FILE_DIALOG_ACCEPT_STRING;
626constexpr 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:548
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:174
SDL_FileDialogType FileDialogType
Various types of file dialogs.
Definition: SDL3pp_dialog.h:490
SDL_DialogFileCallback DialogFileCallback
Callback used by file dialog functions.
Definition: SDL3pp_dialog.h:84
std::function< void(const char *const *, int)> DialogFileCB
Callback used by file dialog functions.
Definition: SDL3pp_dialog.h:123
constexpr FileDialogType FILEDIALOG_OPENFOLDER
OPENFOLDER.
Definition: SDL3pp_dialog.h:498
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:492
constexpr FileDialogType FILEDIALOG_SAVEFILE
SAVEFILE.
Definition: SDL3pp_dialog.h:495
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:415
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:66
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:52
Safely wrap Window for non owning parameters.
Definition: SDL3pp_video.h:57