Dialog: Add filter number, remove NULL termination

This commit is contained in:
Semphris
2024-05-22 19:20:40 -04:00
committed by Sam Lantinga
parent 3e70964ae2
commit 8c8ee2174d
17 changed files with 144 additions and 147 deletions

View File

@@ -78,10 +78,9 @@ typedef struct SDL_DialogFileFilter
* The filelist argument does not need to be freed; it will automatically be
* freed when the callback returns.
*
* The filter argument is the index of the filter that was selected, or one
* more than the size of the list (therefore the index of the terminating NULL
* entry) if no filter was selected, or -1 if the platform or method doesn't
* support fetching the selected filter.
* The filter argument is the index of the filter that was selected, or -1 if
* no filter was selected or if the platform or method doesn't support fetching
* the selected filter.
*
* \param userdata An app-provided pointer, for the callback's use.
* \param filelist The file(s) chosen by the user.
@@ -135,9 +134,10 @@ typedef void(SDLCALL *SDL_DialogFileCallback)(void *userdata, const char * const
* it will be invoked.
* \param window The window that the dialog should be modal for. May be NULL.
* Not all platforms support this option.
* \param filters A null-terminated list of SDL_DialogFileFilter's. May be
* NULL. Not all platforms support this option, and platforms
* that do support it may allow the user to ignore the filters.
* \param filters A list of SDL_DialogFileFilter's. May be NULL. Not all
* platforms support this option, and platforms that do support
* it may allow the user to ignore the filters.
* \param nfilters The number of filters. Ignored if filters is NULL.
* \param default_location The default folder or file to start the dialog at.
* May be NULL. Not all platforms support this option.
* \param allow_many If non-zero, the user will be allowed to select multiple
@@ -150,7 +150,7 @@ typedef void(SDLCALL *SDL_DialogFileCallback)(void *userdata, const char * const
* \sa SDL_ShowSaveFileDialog
* \sa SDL_ShowOpenFolderDialog
*/
extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, const char *default_location, SDL_bool allow_many);
extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, SDL_bool allow_many);
/**
* Displays a dialog that lets the user choose a new or existing file on their
@@ -191,9 +191,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback c
* it will be invoked.
* \param window The window that the dialog should be modal for. May be NULL.
* Not all platforms support this option.
* \param filters A null-terminated list of SDL_DialogFileFilter's. May be
* NULL. Not all platforms support this option, and platforms
* that do support it may allow the user to ignore the filters.
* \param filters A list of SDL_DialogFileFilter's. May be NULL. Not all
* platforms support this option, and platforms that do support
* it may allow the user to ignore the filters.
* \param nfilters The number of filters. Ignored if filters is NULL.
* \param default_location The default folder or file to start the dialog at.
* May be NULL. Not all platforms support this option.
*
@@ -204,7 +205,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback c
* \sa SDL_ShowOpenFileDialog
* \sa SDL_ShowOpenFolderDialog
*/
extern SDL_DECLSPEC void SDLCALL SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, const char *default_location);
extern SDL_DECLSPEC void SDLCALL SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location);
/**
* Displays a dialog that lets the user select a folder on their filesystem.