SDL_DialogFileCallback

Type Alias SDL_DialogFileCallback 

Source
pub type SDL_DialogFileCallback = Option<unsafe extern "C" fn(userdata: *mut c_void, filelist: *const *const c_char, filter: c_int)>;
Expand description

Callback used by file dialog functions.

The specific usage is described in each function.

If filelist is:

  • NULL, an error occurred. Details can be obtained with SDL_GetError().
  • A pointer to NULL, the user either didn’t choose any file or canceled the dialog.
  • A pointer to non-NULL, the user chose one or more files. The argument is a null-terminated array of pointers to UTF-8 encoded strings, each containing a path.

The filelist argument should not be freed; it will automatically be freed when the callback returns.

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.

In Android, the filelist are content:// URIs. They should be opened using SDL_IOFromFile() with appropriate modes. This applies both to open and save file dialog.

§Parameters

  • userdata: an app-provided pointer, for the callback’s use.
  • filelist: the file(s) chosen by the user.
  • filter: index of the selected filter.

§Availability

This datatype is available since SDL 3.2.0.

§See also

Aliased Type§

pub enum SDL_DialogFileCallback {
    None,
    Some(unsafe extern "C" fn(*mut c_void, *const *const i8, i32)),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*mut c_void, *const *const i8, i32))

Some value of type T.