al_create_...ile_dialog(3)
okay so this is the al_create_...ile_dialog(3) page from the Library Functions Manual, and weβre about to make native file dialogs make sense, bestie. π
β¨
π NAME π
al_create_native_file_dialog β Allegro 5 API
β¨ SYNOPSIS β¨
#include <allegro5/allegro_native_dialog.h>
ALLEGRO_FILECHOOSER *al_create_native_file_dialog(
char const *initial_path,
char const *title,
char const *patterns,
int mode)
π¦ DESCRIPTION π¦
Creates a new native file dialog. You should only have one such dialog opened at a time, okay? One at a time, bestie β thatβs the vibe check. π«Ά
Parameters π
initial_pathβ The initial search path and filename. Can beNULL. To start with a blank file name, the string should end with a directory separator β and yes, this should be the common case. πΈtitleβ Title of the dialog. Simple. Iconic. πpatternsβ A string containing newline separated sets of patterns to match. A pattern is either a shell-style glob pattern (e.g."*.txt") or a MIME type (e.g."image/png"). Not all platforms support both (and some donβt even support globs), so a portable solution is to specify a MIME type and simple style globs which Allegro will pick from to match what the platform supports (e.g. do"image/png;*.png"). Multiple patterns are separated using a semicolon. If the platform does not provide support for patterns, this parameter is ignored. π
Here are some example patterns:
"*.txt"β defines a single filter, matching*.txtfiles."*.txt;*.md"β like above, but matching two types of files."Text files (*.txt, *.md) *.txt;*.md"β like above, but with a custom description (separated from the patterns using a space)."Text files *.txt\nPNG images image/png;*.png"β defines two filters, with the second filter using a MIME type and extension at the same time.
Note: Windows does not support MIME types. Android supports only MIME types. Instead of file patterns, MacOS supports extensions, so matching based on filename beyond file type does not work. Allegro will parse your file pattern to try to extract the file extension. MacOS also supports MIME types, which behave more predictably. MacOS does not support detailed descriptions or multiple pattern sets, Allegro will strip the detailed descriptions and concatenate all patterns into one list. π
modeβ0, or a combination of the following flags:ALLEGRO_FILECHOOSER_FILE_MUST_EXISTβ If supported by the native dialog, it will not allow entering new names, but just allow existing files to be selected. Else it is ignored. π₯ALLEGRO_FILECHOOSER_SAVEβ If the native dialog system has a different dialog for saving (for example one which allows creating new directories), it is used. Else it is ignored. πΎALLEGRO_FILECHOOSER_FOLDERβ If there is support for a separate dialog to select a folder instead of a file, it will be used. ποΈALLEGRO_FILECHOOSER_PICTURESβ If a different dialog is available for selecting pictures, it is used. Else it is ignored. πΌοΈALLEGRO_FILECHOOSER_SHOW_HIDDENβ If the platform supports it, also hidden files will be shown. πALLEGRO_FILECHOOSER_MULTIPLEβ If supported, allow selecting multiple files. π
Returns π«Ά
A handle to the dialog which you can pass to al_show_native_file_dialog(3) to display it, and from which you then can query the results using al_get_native_file_dialog_count(3) and al_get_native_file_dialog_path(3). When you are done, call al_destroy_native_file_dialog(3) on it. β¨
If a dialog window could not be created then this function returns NULL. π
Signing off from the Allegro reference manual, page al_create_...ile_dialog(3) β the footer does not list a date, so thatβs the whole cute little source/version situation. πππ¦
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms