sdl3_sys/generated/
messagebox.rs

1//! SDL offers a simple message box API, which is useful for simple alerts,
2//! such as informing the user when something fatal happens at startup without
3//! the need to build a UI for it (or informing the user _before_ your UI is
4//! ready).
5//!
6//! These message boxes are native system dialogs where possible.
7//!
8//! There is both a customizable function ([`SDL_ShowMessageBox()`]) that offers
9//! lots of options for what to display and reports on what choice the user
10//! made, and also a much-simplified version ([`SDL_ShowSimpleMessageBox()`]),
11//! merely takes a text message and title, and waits until the user presses a
12//! single "OK" UI button. Often, this is all that is necessary.
13
14use super::stdinc::*;
15
16use super::error::*;
17
18use super::video::*;
19
20/// Message box flags.
21///
22/// If supported will display warning icon, etc.
23///
24/// ## Availability
25/// This datatype is available since SDL 3.2.0.
26///
27/// ## Known values (`sdl3-sys`)
28/// | Associated constant | Global constant | Description |
29/// | ------------------- | --------------- | ----------- |
30/// | [`ERROR`](SDL_MessageBoxFlags::ERROR) | [`SDL_MESSAGEBOX_ERROR`] | error dialog |
31/// | [`WARNING`](SDL_MessageBoxFlags::WARNING) | [`SDL_MESSAGEBOX_WARNING`] | warning dialog |
32/// | [`INFORMATION`](SDL_MessageBoxFlags::INFORMATION) | [`SDL_MESSAGEBOX_INFORMATION`] | informational dialog |
33/// | [`BUTTONS_LEFT_TO_RIGHT`](SDL_MessageBoxFlags::BUTTONS_LEFT_TO_RIGHT) | [`SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT`] | buttons placed left to right |
34/// | [`BUTTONS_RIGHT_TO_LEFT`](SDL_MessageBoxFlags::BUTTONS_RIGHT_TO_LEFT) | [`SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT`] | buttons placed right to left |
35#[repr(transparent)]
36#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
37pub struct SDL_MessageBoxFlags(pub Uint32);
38
39impl ::core::cmp::PartialEq<Uint32> for SDL_MessageBoxFlags {
40    #[inline(always)]
41    fn eq(&self, other: &Uint32) -> bool {
42        &self.0 == other
43    }
44}
45
46impl ::core::cmp::PartialEq<SDL_MessageBoxFlags> for Uint32 {
47    #[inline(always)]
48    fn eq(&self, other: &SDL_MessageBoxFlags) -> bool {
49        self == &other.0
50    }
51}
52
53impl From<SDL_MessageBoxFlags> for Uint32 {
54    #[inline(always)]
55    fn from(value: SDL_MessageBoxFlags) -> Self {
56        value.0
57    }
58}
59
60#[cfg(feature = "debug-impls")]
61impl ::core::fmt::Debug for SDL_MessageBoxFlags {
62    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
63        let mut first = true;
64        let all_bits = 0;
65        write!(f, "SDL_MessageBoxFlags(")?;
66        let all_bits = all_bits | Self::ERROR.0;
67        if (Self::ERROR != 0 || self.0 == 0) && *self & Self::ERROR == Self::ERROR {
68            if !first {
69                write!(f, " | ")?;
70            }
71            first = false;
72            write!(f, "ERROR")?;
73        }
74        let all_bits = all_bits | Self::WARNING.0;
75        if (Self::WARNING != 0 || self.0 == 0) && *self & Self::WARNING == Self::WARNING {
76            if !first {
77                write!(f, " | ")?;
78            }
79            first = false;
80            write!(f, "WARNING")?;
81        }
82        let all_bits = all_bits | Self::INFORMATION.0;
83        if (Self::INFORMATION != 0 || self.0 == 0) && *self & Self::INFORMATION == Self::INFORMATION
84        {
85            if !first {
86                write!(f, " | ")?;
87            }
88            first = false;
89            write!(f, "INFORMATION")?;
90        }
91        let all_bits = all_bits | Self::BUTTONS_LEFT_TO_RIGHT.0;
92        if (Self::BUTTONS_LEFT_TO_RIGHT != 0 || self.0 == 0)
93            && *self & Self::BUTTONS_LEFT_TO_RIGHT == Self::BUTTONS_LEFT_TO_RIGHT
94        {
95            if !first {
96                write!(f, " | ")?;
97            }
98            first = false;
99            write!(f, "BUTTONS_LEFT_TO_RIGHT")?;
100        }
101        let all_bits = all_bits | Self::BUTTONS_RIGHT_TO_LEFT.0;
102        if (Self::BUTTONS_RIGHT_TO_LEFT != 0 || self.0 == 0)
103            && *self & Self::BUTTONS_RIGHT_TO_LEFT == Self::BUTTONS_RIGHT_TO_LEFT
104        {
105            if !first {
106                write!(f, " | ")?;
107            }
108            first = false;
109            write!(f, "BUTTONS_RIGHT_TO_LEFT")?;
110        }
111
112        if self.0 & !all_bits != 0 {
113            if !first {
114                write!(f, " | ")?;
115            }
116            write!(f, "{:#x}", self.0)?;
117        } else if first {
118            write!(f, "0")?;
119        }
120        write!(f, ")")
121    }
122}
123
124impl ::core::ops::BitAnd for SDL_MessageBoxFlags {
125    type Output = Self;
126
127    #[inline(always)]
128    fn bitand(self, rhs: Self) -> Self::Output {
129        Self(self.0 & rhs.0)
130    }
131}
132
133impl ::core::ops::BitAndAssign for SDL_MessageBoxFlags {
134    #[inline(always)]
135    fn bitand_assign(&mut self, rhs: Self) {
136        self.0 &= rhs.0;
137    }
138}
139
140impl ::core::ops::BitOr for SDL_MessageBoxFlags {
141    type Output = Self;
142
143    #[inline(always)]
144    fn bitor(self, rhs: Self) -> Self::Output {
145        Self(self.0 | rhs.0)
146    }
147}
148
149impl ::core::ops::BitOrAssign for SDL_MessageBoxFlags {
150    #[inline(always)]
151    fn bitor_assign(&mut self, rhs: Self) {
152        self.0 |= rhs.0;
153    }
154}
155
156impl ::core::ops::BitXor for SDL_MessageBoxFlags {
157    type Output = Self;
158
159    #[inline(always)]
160    fn bitxor(self, rhs: Self) -> Self::Output {
161        Self(self.0 ^ rhs.0)
162    }
163}
164
165impl ::core::ops::BitXorAssign for SDL_MessageBoxFlags {
166    #[inline(always)]
167    fn bitxor_assign(&mut self, rhs: Self) {
168        self.0 ^= rhs.0;
169    }
170}
171
172impl ::core::ops::Not for SDL_MessageBoxFlags {
173    type Output = Self;
174
175    #[inline(always)]
176    fn not(self) -> Self::Output {
177        Self(!self.0)
178    }
179}
180
181impl SDL_MessageBoxFlags {
182    /// error dialog
183    pub const ERROR: Self = Self((0x00000010 as Uint32));
184    /// warning dialog
185    pub const WARNING: Self = Self((0x00000020 as Uint32));
186    /// informational dialog
187    pub const INFORMATION: Self = Self((0x00000040 as Uint32));
188    /// buttons placed left to right
189    pub const BUTTONS_LEFT_TO_RIGHT: Self = Self((0x00000080 as Uint32));
190    /// buttons placed right to left
191    pub const BUTTONS_RIGHT_TO_LEFT: Self = Self((0x00000100 as Uint32));
192}
193
194/// error dialog
195pub const SDL_MESSAGEBOX_ERROR: SDL_MessageBoxFlags = SDL_MessageBoxFlags::ERROR;
196/// warning dialog
197pub const SDL_MESSAGEBOX_WARNING: SDL_MessageBoxFlags = SDL_MessageBoxFlags::WARNING;
198/// informational dialog
199pub const SDL_MESSAGEBOX_INFORMATION: SDL_MessageBoxFlags = SDL_MessageBoxFlags::INFORMATION;
200/// buttons placed left to right
201pub const SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT: SDL_MessageBoxFlags =
202    SDL_MessageBoxFlags::BUTTONS_LEFT_TO_RIGHT;
203/// buttons placed right to left
204pub const SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT: SDL_MessageBoxFlags =
205    SDL_MessageBoxFlags::BUTTONS_RIGHT_TO_LEFT;
206
207#[cfg(feature = "metadata")]
208impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxFlags {
209    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
210        &crate::metadata::messagebox::METADATA_SDL_MessageBoxFlags;
211}
212
213/// [`SDL_MessageBoxButtonData`] flags.
214///
215/// ## Availability
216/// This datatype is available since SDL 3.2.0.
217///
218/// ## Known values (`sdl3-sys`)
219/// | Associated constant | Global constant | Description |
220/// | ------------------- | --------------- | ----------- |
221/// | [`RETURNKEY_DEFAULT`](SDL_MessageBoxButtonFlags::RETURNKEY_DEFAULT) | [`SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT`] | Marks the default button when return is hit |
222/// | [`ESCAPEKEY_DEFAULT`](SDL_MessageBoxButtonFlags::ESCAPEKEY_DEFAULT) | [`SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT`] | Marks the default button when escape is hit |
223#[repr(transparent)]
224#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
225pub struct SDL_MessageBoxButtonFlags(pub Uint32);
226
227impl ::core::cmp::PartialEq<Uint32> for SDL_MessageBoxButtonFlags {
228    #[inline(always)]
229    fn eq(&self, other: &Uint32) -> bool {
230        &self.0 == other
231    }
232}
233
234impl ::core::cmp::PartialEq<SDL_MessageBoxButtonFlags> for Uint32 {
235    #[inline(always)]
236    fn eq(&self, other: &SDL_MessageBoxButtonFlags) -> bool {
237        self == &other.0
238    }
239}
240
241impl From<SDL_MessageBoxButtonFlags> for Uint32 {
242    #[inline(always)]
243    fn from(value: SDL_MessageBoxButtonFlags) -> Self {
244        value.0
245    }
246}
247
248#[cfg(feature = "debug-impls")]
249impl ::core::fmt::Debug for SDL_MessageBoxButtonFlags {
250    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
251        let mut first = true;
252        let all_bits = 0;
253        write!(f, "SDL_MessageBoxButtonFlags(")?;
254        let all_bits = all_bits | Self::RETURNKEY_DEFAULT.0;
255        if (Self::RETURNKEY_DEFAULT != 0 || self.0 == 0)
256            && *self & Self::RETURNKEY_DEFAULT == Self::RETURNKEY_DEFAULT
257        {
258            if !first {
259                write!(f, " | ")?;
260            }
261            first = false;
262            write!(f, "RETURNKEY_DEFAULT")?;
263        }
264        let all_bits = all_bits | Self::ESCAPEKEY_DEFAULT.0;
265        if (Self::ESCAPEKEY_DEFAULT != 0 || self.0 == 0)
266            && *self & Self::ESCAPEKEY_DEFAULT == Self::ESCAPEKEY_DEFAULT
267        {
268            if !first {
269                write!(f, " | ")?;
270            }
271            first = false;
272            write!(f, "ESCAPEKEY_DEFAULT")?;
273        }
274
275        if self.0 & !all_bits != 0 {
276            if !first {
277                write!(f, " | ")?;
278            }
279            write!(f, "{:#x}", self.0)?;
280        } else if first {
281            write!(f, "0")?;
282        }
283        write!(f, ")")
284    }
285}
286
287impl ::core::ops::BitAnd for SDL_MessageBoxButtonFlags {
288    type Output = Self;
289
290    #[inline(always)]
291    fn bitand(self, rhs: Self) -> Self::Output {
292        Self(self.0 & rhs.0)
293    }
294}
295
296impl ::core::ops::BitAndAssign for SDL_MessageBoxButtonFlags {
297    #[inline(always)]
298    fn bitand_assign(&mut self, rhs: Self) {
299        self.0 &= rhs.0;
300    }
301}
302
303impl ::core::ops::BitOr for SDL_MessageBoxButtonFlags {
304    type Output = Self;
305
306    #[inline(always)]
307    fn bitor(self, rhs: Self) -> Self::Output {
308        Self(self.0 | rhs.0)
309    }
310}
311
312impl ::core::ops::BitOrAssign for SDL_MessageBoxButtonFlags {
313    #[inline(always)]
314    fn bitor_assign(&mut self, rhs: Self) {
315        self.0 |= rhs.0;
316    }
317}
318
319impl ::core::ops::BitXor for SDL_MessageBoxButtonFlags {
320    type Output = Self;
321
322    #[inline(always)]
323    fn bitxor(self, rhs: Self) -> Self::Output {
324        Self(self.0 ^ rhs.0)
325    }
326}
327
328impl ::core::ops::BitXorAssign for SDL_MessageBoxButtonFlags {
329    #[inline(always)]
330    fn bitxor_assign(&mut self, rhs: Self) {
331        self.0 ^= rhs.0;
332    }
333}
334
335impl ::core::ops::Not for SDL_MessageBoxButtonFlags {
336    type Output = Self;
337
338    #[inline(always)]
339    fn not(self) -> Self::Output {
340        Self(!self.0)
341    }
342}
343
344impl SDL_MessageBoxButtonFlags {
345    /// Marks the default button when return is hit
346    pub const RETURNKEY_DEFAULT: Self = Self((0x00000001 as Uint32));
347    /// Marks the default button when escape is hit
348    pub const ESCAPEKEY_DEFAULT: Self = Self((0x00000002 as Uint32));
349}
350
351/// Marks the default button when return is hit
352pub const SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT: SDL_MessageBoxButtonFlags =
353    SDL_MessageBoxButtonFlags::RETURNKEY_DEFAULT;
354/// Marks the default button when escape is hit
355pub const SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT: SDL_MessageBoxButtonFlags =
356    SDL_MessageBoxButtonFlags::ESCAPEKEY_DEFAULT;
357
358#[cfg(feature = "metadata")]
359impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxButtonFlags {
360    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
361        &crate::metadata::messagebox::METADATA_SDL_MessageBoxButtonFlags;
362}
363
364/// Individual button data.
365///
366/// ## Availability
367/// This struct is available since SDL 3.2.0.
368#[repr(C)]
369#[derive(Clone, Copy)]
370#[cfg_attr(feature = "debug-impls", derive(Debug))]
371pub struct SDL_MessageBoxButtonData {
372    pub flags: SDL_MessageBoxButtonFlags,
373    /// User defined button id (value returned via [`SDL_ShowMessageBox`])
374    pub buttonID: ::core::ffi::c_int,
375    /// The UTF-8 button text
376    pub text: *const ::core::ffi::c_char,
377}
378
379impl ::core::default::Default for SDL_MessageBoxButtonData {
380    /// Initialize all fields to zero
381    #[inline(always)]
382    fn default() -> Self {
383        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
384    }
385}
386
387/// RGB value used in a message box color scheme
388///
389/// ## Availability
390/// This struct is available since SDL 3.2.0.
391#[repr(C)]
392#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
393#[cfg_attr(feature = "debug-impls", derive(Debug))]
394pub struct SDL_MessageBoxColor {
395    pub r: Uint8,
396    pub g: Uint8,
397    pub b: Uint8,
398}
399
400/// An enumeration of indices inside the colors array of
401/// [`SDL_MessageBoxColorScheme`].
402///
403/// ## Known values (`sdl3-sys`)
404/// | Associated constant | Global constant | Description |
405/// | ------------------- | --------------- | ----------- |
406/// | [`BACKGROUND`](SDL_MessageBoxColorType::BACKGROUND) | [`SDL_MESSAGEBOX_COLOR_BACKGROUND`] | |
407/// | [`TEXT`](SDL_MessageBoxColorType::TEXT) | [`SDL_MESSAGEBOX_COLOR_TEXT`] | |
408/// | [`BUTTON_BORDER`](SDL_MessageBoxColorType::BUTTON_BORDER) | [`SDL_MESSAGEBOX_COLOR_BUTTON_BORDER`] | |
409/// | [`BUTTON_BACKGROUND`](SDL_MessageBoxColorType::BUTTON_BACKGROUND) | [`SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND`] | |
410/// | [`BUTTON_SELECTED`](SDL_MessageBoxColorType::BUTTON_SELECTED) | [`SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED`] | |
411/// | [`COUNT`](SDL_MessageBoxColorType::COUNT) | [`SDL_MESSAGEBOX_COLOR_COUNT`] | Size of the colors array of [`SDL_MessageBoxColorScheme`]. |
412#[repr(transparent)]
413#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
414pub struct SDL_MessageBoxColorType(pub ::core::ffi::c_int);
415
416impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_MessageBoxColorType {
417    #[inline(always)]
418    fn eq(&self, other: &::core::ffi::c_int) -> bool {
419        &self.0 == other
420    }
421}
422
423impl ::core::cmp::PartialEq<SDL_MessageBoxColorType> for ::core::ffi::c_int {
424    #[inline(always)]
425    fn eq(&self, other: &SDL_MessageBoxColorType) -> bool {
426        self == &other.0
427    }
428}
429
430impl From<SDL_MessageBoxColorType> for ::core::ffi::c_int {
431    #[inline(always)]
432    fn from(value: SDL_MessageBoxColorType) -> Self {
433        value.0
434    }
435}
436
437#[cfg(feature = "debug-impls")]
438impl ::core::fmt::Debug for SDL_MessageBoxColorType {
439    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
440        #[allow(unreachable_patterns)]
441        f.write_str(match *self {
442            Self::BACKGROUND => "SDL_MESSAGEBOX_COLOR_BACKGROUND",
443            Self::TEXT => "SDL_MESSAGEBOX_COLOR_TEXT",
444            Self::BUTTON_BORDER => "SDL_MESSAGEBOX_COLOR_BUTTON_BORDER",
445            Self::BUTTON_BACKGROUND => "SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND",
446            Self::BUTTON_SELECTED => "SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED",
447            Self::COUNT => "SDL_MESSAGEBOX_COLOR_COUNT",
448
449            _ => return write!(f, "SDL_MessageBoxColorType({})", self.0),
450        })
451    }
452}
453
454impl SDL_MessageBoxColorType {
455    pub const BACKGROUND: Self = Self((0 as ::core::ffi::c_int));
456    pub const TEXT: Self = Self((1 as ::core::ffi::c_int));
457    pub const BUTTON_BORDER: Self = Self((2 as ::core::ffi::c_int));
458    pub const BUTTON_BACKGROUND: Self = Self((3 as ::core::ffi::c_int));
459    pub const BUTTON_SELECTED: Self = Self((4 as ::core::ffi::c_int));
460    /// Size of the colors array of [`SDL_MessageBoxColorScheme`].
461    pub const COUNT: Self = Self((5 as ::core::ffi::c_int));
462}
463
464pub const SDL_MESSAGEBOX_COLOR_BACKGROUND: SDL_MessageBoxColorType =
465    SDL_MessageBoxColorType::BACKGROUND;
466pub const SDL_MESSAGEBOX_COLOR_TEXT: SDL_MessageBoxColorType = SDL_MessageBoxColorType::TEXT;
467pub const SDL_MESSAGEBOX_COLOR_BUTTON_BORDER: SDL_MessageBoxColorType =
468    SDL_MessageBoxColorType::BUTTON_BORDER;
469pub const SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND: SDL_MessageBoxColorType =
470    SDL_MessageBoxColorType::BUTTON_BACKGROUND;
471pub const SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED: SDL_MessageBoxColorType =
472    SDL_MessageBoxColorType::BUTTON_SELECTED;
473/// Size of the colors array of [`SDL_MessageBoxColorScheme`].
474pub const SDL_MESSAGEBOX_COLOR_COUNT: SDL_MessageBoxColorType = SDL_MessageBoxColorType::COUNT;
475
476#[cfg(feature = "metadata")]
477impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxColorType {
478    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
479        &crate::metadata::messagebox::METADATA_SDL_MessageBoxColorType;
480}
481
482/// A set of colors to use for message box dialogs
483///
484/// ## Availability
485/// This struct is available since SDL 3.2.0.
486#[repr(C)]
487#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
488#[cfg_attr(feature = "debug-impls", derive(Debug))]
489pub struct SDL_MessageBoxColorScheme {
490    pub colors: [SDL_MessageBoxColor; SDL_MESSAGEBOX_COLOR_COUNT.0 as ::core::primitive::usize],
491}
492
493/// MessageBox structure containing title, text, window, etc.
494///
495/// ## Availability
496/// This struct is available since SDL 3.2.0.
497#[repr(C)]
498#[cfg_attr(feature = "debug-impls", derive(Debug))]
499pub struct SDL_MessageBoxData {
500    pub flags: SDL_MessageBoxFlags,
501    /// Parent window, can be NULL
502    pub window: *mut SDL_Window,
503    /// UTF-8 title
504    pub title: *const ::core::ffi::c_char,
505    /// UTF-8 message text
506    pub message: *const ::core::ffi::c_char,
507    pub numbuttons: ::core::ffi::c_int,
508    pub buttons: *const SDL_MessageBoxButtonData,
509    /// [`SDL_MessageBoxColorScheme`], can be NULL to use system settings
510    pub colorScheme: *const SDL_MessageBoxColorScheme,
511}
512
513impl ::core::default::Default for SDL_MessageBoxData {
514    /// Initialize all fields to zero
515    #[inline(always)]
516    fn default() -> Self {
517        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
518    }
519}
520
521unsafe extern "C" {
522    /// Create a modal message box.
523    ///
524    /// If your needs aren't complex, it might be easier to use
525    /// [`SDL_ShowSimpleMessageBox`].
526    ///
527    /// This function should be called on the thread that created the parent
528    /// window, or on the main thread if the messagebox has no parent. It will
529    /// block execution of that thread until the user clicks a button or closes the
530    /// messagebox.
531    ///
532    /// This function may be called at any time, even before [`SDL_Init()`]. This makes
533    /// it useful for reporting errors like a failure to create a renderer or
534    /// OpenGL context.
535    ///
536    /// On X11, SDL rolls its own dialog box with X11 primitives instead of a
537    /// formal toolkit like GTK+ or Qt.
538    ///
539    /// Note that if [`SDL_Init()`] would fail because there isn't any available video
540    /// target, this function is likely to fail for the same reasons. If this is a
541    /// concern, check the return value from this function and fall back to writing
542    /// to stderr if you can.
543    ///
544    /// ## Parameters
545    /// - `messageboxdata`: the [`SDL_MessageBoxData`] structure with title, text and
546    ///   other options.
547    /// - `buttonid`: the pointer to which user id of hit button should be
548    ///   copied.
549    ///
550    /// ## Return value
551    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
552    ///   information.
553    ///
554    /// ## Availability
555    /// This function is available since SDL 3.2.0.
556    ///
557    /// ## See also
558    /// - [`SDL_ShowSimpleMessageBox`]
559    pub fn SDL_ShowMessageBox(
560        messageboxdata: *const SDL_MessageBoxData,
561        buttonid: *mut ::core::ffi::c_int,
562    ) -> ::core::primitive::bool;
563}
564
565unsafe extern "C" {
566    /// Display a simple modal message box.
567    ///
568    /// If your needs aren't complex, this function is preferred over
569    /// [`SDL_ShowMessageBox`].
570    ///
571    /// `flags` may be any of the following:
572    ///
573    /// - [`SDL_MESSAGEBOX_ERROR`]\: error dialog
574    /// - [`SDL_MESSAGEBOX_WARNING`]\: warning dialog
575    /// - [`SDL_MESSAGEBOX_INFORMATION`]\: informational dialog
576    ///
577    /// This function should be called on the thread that created the parent
578    /// window, or on the main thread if the messagebox has no parent. It will
579    /// block execution of that thread until the user clicks a button or closes the
580    /// messagebox.
581    ///
582    /// This function may be called at any time, even before [`SDL_Init()`]. This makes
583    /// it useful for reporting errors like a failure to create a renderer or
584    /// OpenGL context.
585    ///
586    /// On X11, SDL rolls its own dialog box with X11 primitives instead of a
587    /// formal toolkit like GTK+ or Qt.
588    ///
589    /// Note that if [`SDL_Init()`] would fail because there isn't any available video
590    /// target, this function is likely to fail for the same reasons. If this is a
591    /// concern, check the return value from this function and fall back to writing
592    /// to stderr if you can.
593    ///
594    /// ## Parameters
595    /// - `flags`: an [`SDL_MessageBoxFlags`] value.
596    /// - `title`: UTF-8 title text.
597    /// - `message`: UTF-8 message text.
598    /// - `window`: the parent window, or NULL for no parent.
599    ///
600    /// ## Return value
601    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
602    ///   information.
603    ///
604    /// ## Availability
605    /// This function is available since SDL 3.2.0.
606    ///
607    /// ## See also
608    /// - [`SDL_ShowMessageBox`]
609    pub fn SDL_ShowSimpleMessageBox(
610        flags: SDL_MessageBoxFlags,
611        title: *const ::core::ffi::c_char,
612        message: *const ::core::ffi::c_char,
613        window: *mut SDL_Window,
614    ) -> ::core::primitive::bool;
615}
616
617#[cfg(doc)]
618use crate::everything::*;