mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-07 13:33:13 +00:00
Add sdl3_tray.odin and sdl3_version.odin
This commit is contained in:
52
vendor/sdl3/sdl3_tray.odin
vendored
Normal file
52
vendor/sdl3/sdl3_tray.odin
vendored
Normal 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
23
vendor/sdl3/sdl3_version.odin
vendored
Normal 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 ---
|
||||
}
|
||||
Reference in New Issue
Block a user