120 lines
3.8 KiB
Zig
120 lines
3.8 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
|
|
pub const Surface = opaque {
|
|
pub inline fn createTray(surface: *Surface, tooltip: [*c]const u8) ?*Tray {
|
|
return c.SDL_CreateTray(surface, tooltip);
|
|
}
|
|
|
|
};
|
|
|
|
pub const Tray = opaque {
|
|
pub inline fn setTrayIcon(tray: *Tray, icon: ?*Surface) void {
|
|
return c.SDL_SetTrayIcon(tray, icon);
|
|
}
|
|
|
|
pub inline fn setTrayTooltip(tray: *Tray, tooltip: [*c]const u8) void {
|
|
return c.SDL_SetTrayTooltip(tray, tooltip);
|
|
}
|
|
|
|
pub inline fn createTrayMenu(tray: *Tray) ?*TrayMenu {
|
|
return c.SDL_CreateTrayMenu(tray);
|
|
}
|
|
|
|
pub inline fn getTrayMenu(tray: *Tray) ?*TrayMenu {
|
|
return c.SDL_GetTrayMenu(tray);
|
|
}
|
|
|
|
pub inline fn destroyTray(tray: *Tray) void {
|
|
return c.SDL_DestroyTray(tray);
|
|
}
|
|
|
|
};
|
|
|
|
pub const TrayMenu = opaque {
|
|
pub inline fn getTrayEntries(traymenu: *TrayMenu, count: *c_int) *const TrayEntry * {
|
|
return @ptrCast(c.SDL_GetTrayEntries(traymenu, @ptrCast(count)));
|
|
}
|
|
|
|
pub inline fn insertTrayEntryAt(traymenu: *TrayMenu, pos: c_int, label: [*c]const u8, flags: TrayEntryFlags) ?*TrayEntry {
|
|
return c.SDL_InsertTrayEntryAt(traymenu, pos, label, @bitCast(flags));
|
|
}
|
|
|
|
pub inline fn getTrayMenuParentEntry(traymenu: *TrayMenu) ?*TrayEntry {
|
|
return c.SDL_GetTrayMenuParentEntry(traymenu);
|
|
}
|
|
|
|
pub inline fn getTrayMenuParentTray(traymenu: *TrayMenu) ?*Tray {
|
|
return c.SDL_GetTrayMenuParentTray(traymenu);
|
|
}
|
|
|
|
};
|
|
|
|
pub const TrayEntry = opaque {
|
|
pub inline fn createTraySubmenu(trayentry: *TrayEntry) ?*TrayMenu {
|
|
return c.SDL_CreateTraySubmenu(trayentry);
|
|
}
|
|
|
|
pub inline fn getTraySubmenu(trayentry: *TrayEntry) ?*TrayMenu {
|
|
return c.SDL_GetTraySubmenu(trayentry);
|
|
}
|
|
|
|
pub inline fn removeTrayEntry(trayentry: *TrayEntry) void {
|
|
return c.SDL_RemoveTrayEntry(trayentry);
|
|
}
|
|
|
|
pub inline fn setTrayEntryLabel(trayentry: *TrayEntry, label: [*c]const u8) void {
|
|
return c.SDL_SetTrayEntryLabel(trayentry, label);
|
|
}
|
|
|
|
pub inline fn getTrayEntryLabel(trayentry: *TrayEntry) [*c]const u8 {
|
|
return c.SDL_GetTrayEntryLabel(trayentry);
|
|
}
|
|
|
|
pub inline fn setTrayEntryChecked(trayentry: *TrayEntry, checked: bool) void {
|
|
return c.SDL_SetTrayEntryChecked(trayentry, checked);
|
|
}
|
|
|
|
pub inline fn getTrayEntryChecked(trayentry: *TrayEntry) bool {
|
|
return c.SDL_GetTrayEntryChecked(trayentry);
|
|
}
|
|
|
|
pub inline fn setTrayEntryEnabled(trayentry: *TrayEntry, enabled: bool) void {
|
|
return c.SDL_SetTrayEntryEnabled(trayentry, enabled);
|
|
}
|
|
|
|
pub inline fn getTrayEntryEnabled(trayentry: *TrayEntry) bool {
|
|
return c.SDL_GetTrayEntryEnabled(trayentry);
|
|
}
|
|
|
|
pub inline fn setTrayEntryCallback(trayentry: *TrayEntry, callback: TrayCallback, userdata: ?*anyopaque) void {
|
|
return c.SDL_SetTrayEntryCallback(trayentry, callback, userdata);
|
|
}
|
|
|
|
pub inline fn clickTrayEntry(trayentry: *TrayEntry) void {
|
|
return c.SDL_ClickTrayEntry(trayentry);
|
|
}
|
|
|
|
pub inline fn getTrayEntryParent(trayentry: *TrayEntry) ?*TrayMenu {
|
|
return c.SDL_GetTrayEntryParent(trayentry);
|
|
}
|
|
|
|
};
|
|
|
|
pub const TrayEntryFlags = packed struct(u32) {
|
|
trayentryButton: bool = false, // Make the entry a simple button. Required.
|
|
trayentryCheckbox: bool = false, // Make the entry a checkbox. Required.
|
|
trayentrySubmenu: bool = false, // Prepare the entry to have a submenu. Required
|
|
trayentryDisabled: bool = false, // Make the entry disabled. Optional.
|
|
trayentryChecked: bool = false, // Make the entry checked. This is valid only for checkboxes. Optional.
|
|
pad0: u26 = 0,
|
|
rsvd: bool = false,
|
|
};
|
|
|
|
pub const TrayCallback = *const fn(userdata: ?*anyopaque, entry: ?*TrayEntry) callconv(.C) void;
|
|
|
|
pub inline fn updateTrays() void {
|
|
return c.SDL_UpdateTrays();
|
|
}
|
|
|