Add sdl3_tray.odin and sdl3_version.odin

This commit is contained in:
gingerBill
2025-02-04 16:59:38 +00:00
parent 98271f0073
commit a62ce5cc66
2 changed files with 75 additions and 0 deletions

52
vendor/sdl3/sdl3_tray.odin vendored Normal file
View File

@@ -0,0 +1,52 @@
package sdl3
import "core:c"
Tray :: struct {}
TrayMenu :: struct {}
TrayEntry :: struct {}
TrayEntryFlags :: distinct bit_set[TrayEntryFlag; Uint32]
TrayEntryFlag :: enum Uint32 {
BUTTON = 0, /**< Make the entry a simple button. Required. */
CHECKBOX = 1, /**< Make the entry a checkbox. Required. */
SUBMENU = 2, /**< Prepare the entry to have a submenu. Required */
DISABLED = 31, /**< Make the entry disabled. Optional. */
CHECKED = 30, /**< Make the entry checked. This is valid only for checkboxes. Optional. */
}
TRAYENTRY_BUTTON :: TrayEntryFlags{.BUTTON} /**< Make the entry a simple button. Required. */
TRAYENTRY_CHECKBOX :: TrayEntryFlags{.CHECKBOX} /**< Make the entry a checkbox. Required. */
TRAYENTRY_SUBMENU :: TrayEntryFlags{.SUBMENU} /**< Prepare the entry to have a submenu. Required */
TRAYENTRY_DISABLED :: TrayEntryFlags{.DISABLED} /**< Make the entry disabled. Optional. */
TRAYENTRY_CHECKED :: TrayEntryFlags{.CHECKED} /**< Make the entry checked. This is valid only for checkboxes. Optional. */
TrayCallback :: #type proc "c" (userdata: rawptr, entry: ^TrayEntry)
@(default_calling_convention="c", link_prefix="SDL_", require_results)
foreign lib {
CreateTray :: proc(icon: ^Surface, tooltip: cstring) -> ^Tray ---
SetTrayIcon :: proc(tray: ^Tray, icon: ^Surface) ---
SetTrayTooltip :: proc(tray: ^Tray, tooltip: cstring) ---
CreateTrayMenu :: proc(tray: ^Tray) -> ^TrayMenu ---
CreateTraySubmenu :: proc(entry: ^TrayEntry) -> ^TrayMenu ---
GetTrayMenu :: proc(tray: ^Tray) -> TrayMenu ---
GetTraySubmenu :: proc(entry: ^TrayEntry) -> ^TrayMenu ---
GetTrayEntries :: proc(menu: ^TrayMenu, size: ^c.int) -> [^]^TrayEntry ---
RemoveTrayEntry :: proc(entry: ^TrayEntry) ---
InsertTrayEntryAt :: proc(menu: ^TrayMenu, pos: c.int, label: cstring, flags: TrayEntryFlags) -> ^TrayEntry ---
SetTrayEntryLabel :: proc(entry: ^TrayEntry, label: cstring) ---
GetTrayEntryLabel :: proc(entry: ^TrayEntry) -> cstring ---
SetTrayEntryChecked :: proc(entry: ^TrayEntry, checked: bool) ---
GetTrayEntryChecked :: proc(entry: ^TrayEntry) -> bool ---
SetTrayEntryEnabled :: proc(entry: ^TrayEntry, enabled: bool) ---
GetTrayEntryEnabled :: proc(entry: ^TrayEntry) -> bool ---
SetTrayEntryCallback :: proc(entry: ^TrayEntry, callback: TrayCallback, userdata: rawptr) ---
ClickTrayEntry :: proc(entry: ^TrayEntry) ---
DestroyTray :: proc(tray: ^Tray) ---
GetTrayEntryParent :: proc(entry: ^TrayEntry) -> ^TrayMenu ---
GetTrayMenuParentEntry :: proc(menu: ^TrayMenu) -> ^TrayEntry ---
GetTrayMenuParentTray :: proc(menu: ^TrayMenu) -> ^Tray ---
UpdateTrays :: proc() ---
}

23
vendor/sdl3/sdl3_version.odin vendored Normal file
View File

@@ -0,0 +1,23 @@
package sdl3
import "core:c"
MAJOR_VERSION :: 3
MINOR_VERSION :: 2
MICRO_VERSION :: 0
@(require_results) VERSIONNUM :: #force_inline proc "c" (major, minor, patch: c.int) -> c.int { return (major * 1000000) + (minor * 1000) + patch }
@(require_results) VERSIONNUM_MAJOR :: #force_inline proc "c" (version: c.int) -> c.int { return version / 1000000 }
@(require_results) VERSIONNUM_MINOR :: #force_inline proc "c" (version: c.int) -> c.int { return (version / 1000) % 1000 }
@(require_results) VERSIONNUM_MICRO :: #force_inline proc "c" (version: c.int) -> c.int { return version % 1000 }
VERSION :: MAJOR_VERSION*1000000 + MINOR_VERSION*1000 + MICRO_VERSION
@(require_results) VERSION_ATLEAST :: proc "c" (X, Y, Z: c.int) -> bool { return VERSION >= VERSIONNUM(X, Y, Z) }
@(default_calling_convention="c", link_prefix="SDL_", require_results)
foreign lib {
GetVersion :: proc() -> c.int ---
GetRevision :: proc() -> cstring ---
}