62 lines
1.7 KiB
Zig
62 lines
1.7 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
|
|
pub const Window = opaque {};
|
|
|
|
pub const PropertiesID = u32;
|
|
|
|
pub const DialogFileFilter = extern struct {
|
|
name: [*c]const u8,
|
|
pattern: [*c]const u8,
|
|
};
|
|
|
|
pub const DialogFileCallback = *const fn (userdata: ?*anyopaque, filelist: [*c]const [*c]const u8, filter: c_int) callconv(.C) void;
|
|
|
|
pub inline fn showOpenFileDialog(
|
|
callback: DialogFileCallback,
|
|
userdata: ?*anyopaque,
|
|
window: ?*Window,
|
|
filters: *const DialogFileFilter,
|
|
nfilters: c_int,
|
|
default_location: [*c]const u8,
|
|
allow_many: bool,
|
|
) void {
|
|
return c.SDL_ShowOpenFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location, allow_many);
|
|
}
|
|
|
|
pub inline fn showSaveFileDialog(
|
|
callback: DialogFileCallback,
|
|
userdata: ?*anyopaque,
|
|
window: ?*Window,
|
|
filters: *const DialogFileFilter,
|
|
nfilters: c_int,
|
|
default_location: [*c]const u8,
|
|
) void {
|
|
return c.SDL_ShowSaveFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location);
|
|
}
|
|
|
|
pub inline fn showOpenFolderDialog(
|
|
callback: DialogFileCallback,
|
|
userdata: ?*anyopaque,
|
|
window: ?*Window,
|
|
default_location: [*c]const u8,
|
|
allow_many: bool,
|
|
) void {
|
|
return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, allow_many);
|
|
}
|
|
|
|
pub const FileDialogType = enum(c_int) {
|
|
filedialogOpenfile,
|
|
filedialogSavefile,
|
|
filedialogOpenfolder,
|
|
};
|
|
|
|
pub inline fn showFileDialogWithProperties(
|
|
type: FileDialogType,
|
|
callback: DialogFileCallback,
|
|
userdata: ?*anyopaque,
|
|
props: PropertiesID,
|
|
) void {
|
|
return c.SDL_ShowFileDialogWithProperties(@intFromEnum(type), callback, userdata, props);
|
|
}
|