1 //from "sdl_messagebox.h"
3 {**
4 * SDL_MessageBox flags. If supported will display warning icon, etc.
5 *}
7 const
8 SDL_MESSAGEBOX_ERROR = $00000010; {**< error dialog *}
9 SDL_MESSAGEBOX_WARNING = $00000020; {**< warning dialog *}
10 SDL_MESSAGEBOX_INFORMATION = $00000040; {**< informational dialog *}
12 type
13 TSDL_MessageBoxFlags = Byte;
15 {**
16 * Flags for SDL_MessageBoxButtonData.
17 *}
18 const
19 SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = $00000001; {**< Marks the default button when return is hit *}
20 SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = $00000002; {**< Marks the default button when escape is hit *}
21 type
22 TSDL_MessageBoxButtonFlags = Byte;
24 {**
25 * Individual button data.
26 *}
27 type
28 PSDL_MessageBoxButtonData = ^TSDL_MessageBoxButtonData;
29 TSDL_MessageBoxButtonData = record
30 flags: UInt32; {**< ::SDL_MessageBoxButtonFlags *}
31 buttonid: Integer; {**< User defined button id (value returned via SDL_ShowMessageBox) *}
32 text: PAnsiChar; {**< The UTF-8 button text *}
33 end;
35 {**
36 * RGB value used in a message box color scheme
37 *}
38 type
39 PSDL_MessageBoxColor = ^TSDL_MessageBoxColor;
40 TSDL_MessageBoxColor = record
41 r, g, b: UInt8;
42 end;
44 PSDL_MessageBoxColorType = ^TSDL_MessageBoxColorType;
45 TSDL_MessageBoxColorType = (SDL_MESSAGEBOX_COLOR_BACKGROUND,
46 SDL_MESSAGEBOX_COLOR_TEXT,
47 SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
48 SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
49 SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
50 SDL_MESSAGEBOX_COLOR_MAX);
52 {**
53 * A set of colors to use for message box dialogs
54 *}
55 type
56 PSDL_MessageBoxColorScheme = ^TSDL_MessageBoxColorScheme;
57 TSDL_MessageBoxColorScheme = record
58 //colors: array[0..SDL_MESSAGEBOX_COLOR_MAX-1] of TSDL_MessageBoxColor;
59 colors: array[0..4] of TSDL_MessageBoxColor; //right?!
60 end;
62 {**
63 * MessageBox structure containing title, text, window, etc.
64 *}
65 type
66 PSDL_MessageBoxData = ^TSDL_MessageBoxData;
67 TSDL_MessageBoxData = record
68 flags: UInt32; {**< SDL_MessageBoxFlags *}
69 window: PSDL_Window; {**< Parent window, can be NULL *}
70 title: PAnsiChar; {**< UTF-8 title *}
71 _message: PAnsiChar; {**< UTF-8 message text *}
73 numbuttons: Integer;
74 buttons: PSDL_MessageBoxButtonData;
76 colorScheme: PSDL_MessageBoxColorScheme; {**< SDL_MessageBoxColorScheme, can be NULL to use system settings *}
77 end;
79 {**
80 * Create a modal message box.
81 *
82 * messageboxdata The SDL_MessageBoxData structure with title, text, etc.
83 * buttonid The pointer to which user id of hit button should be copied.
84 *
85 * -1 on error, otherwise 0 and buttonid contains user id of button
86 * hit or -1 if dialog was closed.
87 *
88 * This function should be called on the thread that created the parent
89 * window, or on the main thread if the messagebox has no parent. It will
90 * block execution of that thread until the user clicks a button or
91 * closes the messagebox.
92 *}
93 function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: PInt): Integer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowMessageBox' {$ENDIF} {$ENDIF};
95 {**
96 * Create a simple modal message box
97 *
98 * flags SDL_MessageBoxFlags
99 * title UTF-8 title text
100 * message UTF-8 message text
101 * window The parent window, or NULL for no parent
102 *
103 * 0 on success, -1 on error
104 *
105 * SDL_ShowMessageBox
106 *}
107 function SDL_ShowSimpleMessageBox(flags: UInt32; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): Integer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowSimpleMessageBox' {$ENDIF} {$ENDIF};