aboutsummaryrefslogtreecommitdiff
path: root/vendor/sdl3/sdl3_messagebox.odin
blob: 2c60b3f79941abef2676c9afd370ed8a1bd380ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package sdl3

import "core:c"

MessageBoxFlags :: distinct bit_set[MessageBoxFlag; Uint32]
MessageBoxFlag :: enum Uint32 {
	ERROR                 = 4, /**< error dialog */
	WARNING               = 5, /**< warning dialog */
	INFORMATION           = 6, /**< informational dialog */
	BUTTONS_LEFT_TO_RIGHT = 7, /**< buttons placed left to right */
	BUTTONS_RIGHT_TO_LEFT = 8, /**< buttons placed right to left */
}

MessageBoxButtonFlags :: distinct bit_set[MessageBoxButtonFlag; Uint32]
MessageBoxButtonFlag  :: enum Uint32 {
	RETURNKEY_DEFAULT = 0, /**< Marks the default button when return is hit */
	ESCAPEKEY_DEFAULT = 1, /**< Marks the default button when return is hit */
}

MessageBoxButtonData :: struct {
	flags:    MessageBoxButtonFlags,
	buttonID: c.int,     /**< User defined button id (value returned via SDL_ShowMessageBox) */
	text:     cstring,   /**< The UTF-8 button text */
}


MessageBoxColor :: distinct [3]Uint8

MessageBoxColorType :: enum c.int {
	BACKGROUND,
	TEXT,
	BUTTON_BORDER,
	BUTTON_BACKGROUND,
	BUTTON_SELECTED,
}



MessageBoxColorScheme :: struct {
	colors: [MessageBoxColorType]MessageBoxColor,
}


MessageBoxData :: struct {
	flags:       MessageBoxFlags,
	window:      ^Window,                /**< Parent window, can be NULL */
	title:       cstring,                /**< UTF-8 title */
	message:     cstring,                /**< UTF-8 message text */

	numbuttons:  c.int,
	buttons:     [^]MessageBoxButtonData `fmt:"v,numbuttons"`,

	colorScheme: ^MessageBoxColorScheme, /**< MessageBoxColorScheme, can be NULL to use system settings */
}


@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
	ShowMessageBox       :: proc(#by_ptr messageboxdata: MessageBoxData, buttonid: ^c.int) -> bool ---
	ShowSimpleMessageBox :: proc(flags: MessageBoxFlags, title, message: cstring, window: ^Window) -> bool ---
}