Skip to main content

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
207impl SDL_MessageBoxFlags {
208    /// Initialize a `SDL_MessageBoxFlags` from a raw value.
209    #[inline(always)]
210    pub const fn new(value: Uint32) -> Self {
211        Self(value)
212    }
213}
214
215impl SDL_MessageBoxFlags {
216    /// Get a copy of the inner raw value.
217    #[inline(always)]
218    pub const fn value(&self) -> Uint32 {
219        self.0
220    }
221}
222
223#[cfg(feature = "metadata")]
224impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxFlags {
225    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
226        &crate::metadata::messagebox::METADATA_SDL_MessageBoxFlags;
227}
228
229/// [`SDL_MessageBoxButtonData`] flags.
230///
231/// ## Availability
232/// This datatype is available since SDL 3.2.0.
233///
234/// ## Known values (`sdl3-sys`)
235/// | Associated constant | Global constant | Description |
236/// | ------------------- | --------------- | ----------- |
237/// | [`RETURNKEY_DEFAULT`](SDL_MessageBoxButtonFlags::RETURNKEY_DEFAULT) | [`SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT`] | Marks the default button when return is hit |
238/// | [`ESCAPEKEY_DEFAULT`](SDL_MessageBoxButtonFlags::ESCAPEKEY_DEFAULT) | [`SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT`] | Marks the default button when escape is hit |
239#[repr(transparent)]
240#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
241pub struct SDL_MessageBoxButtonFlags(pub Uint32);
242
243impl ::core::cmp::PartialEq<Uint32> for SDL_MessageBoxButtonFlags {
244    #[inline(always)]
245    fn eq(&self, other: &Uint32) -> bool {
246        &self.0 == other
247    }
248}
249
250impl ::core::cmp::PartialEq<SDL_MessageBoxButtonFlags> for Uint32 {
251    #[inline(always)]
252    fn eq(&self, other: &SDL_MessageBoxButtonFlags) -> bool {
253        self == &other.0
254    }
255}
256
257impl From<SDL_MessageBoxButtonFlags> for Uint32 {
258    #[inline(always)]
259    fn from(value: SDL_MessageBoxButtonFlags) -> Self {
260        value.0
261    }
262}
263
264#[cfg(feature = "debug-impls")]
265impl ::core::fmt::Debug for SDL_MessageBoxButtonFlags {
266    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
267        let mut first = true;
268        let all_bits = 0;
269        write!(f, "SDL_MessageBoxButtonFlags(")?;
270        let all_bits = all_bits | Self::RETURNKEY_DEFAULT.0;
271        if (Self::RETURNKEY_DEFAULT != 0 || self.0 == 0)
272            && *self & Self::RETURNKEY_DEFAULT == Self::RETURNKEY_DEFAULT
273        {
274            if !first {
275                write!(f, " | ")?;
276            }
277            first = false;
278            write!(f, "RETURNKEY_DEFAULT")?;
279        }
280        let all_bits = all_bits | Self::ESCAPEKEY_DEFAULT.0;
281        if (Self::ESCAPEKEY_DEFAULT != 0 || self.0 == 0)
282            && *self & Self::ESCAPEKEY_DEFAULT == Self::ESCAPEKEY_DEFAULT
283        {
284            if !first {
285                write!(f, " | ")?;
286            }
287            first = false;
288            write!(f, "ESCAPEKEY_DEFAULT")?;
289        }
290
291        if self.0 & !all_bits != 0 {
292            if !first {
293                write!(f, " | ")?;
294            }
295            write!(f, "{:#x}", self.0)?;
296        } else if first {
297            write!(f, "0")?;
298        }
299        write!(f, ")")
300    }
301}
302
303impl ::core::ops::BitAnd for SDL_MessageBoxButtonFlags {
304    type Output = Self;
305
306    #[inline(always)]
307    fn bitand(self, rhs: Self) -> Self::Output {
308        Self(self.0 & rhs.0)
309    }
310}
311
312impl ::core::ops::BitAndAssign for SDL_MessageBoxButtonFlags {
313    #[inline(always)]
314    fn bitand_assign(&mut self, rhs: Self) {
315        self.0 &= rhs.0;
316    }
317}
318
319impl ::core::ops::BitOr for SDL_MessageBoxButtonFlags {
320    type Output = Self;
321
322    #[inline(always)]
323    fn bitor(self, rhs: Self) -> Self::Output {
324        Self(self.0 | rhs.0)
325    }
326}
327
328impl ::core::ops::BitOrAssign for SDL_MessageBoxButtonFlags {
329    #[inline(always)]
330    fn bitor_assign(&mut self, rhs: Self) {
331        self.0 |= rhs.0;
332    }
333}
334
335impl ::core::ops::BitXor for SDL_MessageBoxButtonFlags {
336    type Output = Self;
337
338    #[inline(always)]
339    fn bitxor(self, rhs: Self) -> Self::Output {
340        Self(self.0 ^ rhs.0)
341    }
342}
343
344impl ::core::ops::BitXorAssign for SDL_MessageBoxButtonFlags {
345    #[inline(always)]
346    fn bitxor_assign(&mut self, rhs: Self) {
347        self.0 ^= rhs.0;
348    }
349}
350
351impl ::core::ops::Not for SDL_MessageBoxButtonFlags {
352    type Output = Self;
353
354    #[inline(always)]
355    fn not(self) -> Self::Output {
356        Self(!self.0)
357    }
358}
359
360impl SDL_MessageBoxButtonFlags {
361    /// Marks the default button when return is hit
362    pub const RETURNKEY_DEFAULT: Self = Self((0x00000001 as Uint32));
363    /// Marks the default button when escape is hit
364    pub const ESCAPEKEY_DEFAULT: Self = Self((0x00000002 as Uint32));
365}
366
367/// Marks the default button when return is hit
368pub const SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT: SDL_MessageBoxButtonFlags =
369    SDL_MessageBoxButtonFlags::RETURNKEY_DEFAULT;
370/// Marks the default button when escape is hit
371pub const SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT: SDL_MessageBoxButtonFlags =
372    SDL_MessageBoxButtonFlags::ESCAPEKEY_DEFAULT;
373
374impl SDL_MessageBoxButtonFlags {
375    /// Initialize a `SDL_MessageBoxButtonFlags` from a raw value.
376    #[inline(always)]
377    pub const fn new(value: Uint32) -> Self {
378        Self(value)
379    }
380}
381
382impl SDL_MessageBoxButtonFlags {
383    /// Get a copy of the inner raw value.
384    #[inline(always)]
385    pub const fn value(&self) -> Uint32 {
386        self.0
387    }
388}
389
390#[cfg(feature = "metadata")]
391impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxButtonFlags {
392    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
393        &crate::metadata::messagebox::METADATA_SDL_MessageBoxButtonFlags;
394}
395
396/// Individual button data.
397///
398/// ## Availability
399/// This struct is available since SDL 3.2.0.
400#[repr(C)]
401#[derive(Clone, Copy)]
402#[cfg_attr(feature = "debug-impls", derive(Debug))]
403pub struct SDL_MessageBoxButtonData {
404    pub flags: SDL_MessageBoxButtonFlags,
405    /// User defined button id (value returned via [`SDL_ShowMessageBox`])
406    pub buttonID: ::core::ffi::c_int,
407    /// The UTF-8 button text
408    pub text: *const ::core::ffi::c_char,
409}
410
411impl ::core::default::Default for SDL_MessageBoxButtonData {
412    /// Initialize all fields to zero
413    #[inline(always)]
414    fn default() -> Self {
415        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
416    }
417}
418
419/// RGB value used in a message box color scheme
420///
421/// ## Availability
422/// This struct is available since SDL 3.2.0.
423#[repr(C)]
424#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
425#[cfg_attr(feature = "debug-impls", derive(Debug))]
426pub struct SDL_MessageBoxColor {
427    pub r: Uint8,
428    pub g: Uint8,
429    pub b: Uint8,
430}
431
432/// An enumeration of indices inside the colors array of
433/// [`SDL_MessageBoxColorScheme`].
434///
435/// ## Known values (`sdl3-sys`)
436/// | Associated constant | Global constant | Description |
437/// | ------------------- | --------------- | ----------- |
438/// | [`BACKGROUND`](SDL_MessageBoxColorType::BACKGROUND) | [`SDL_MESSAGEBOX_COLOR_BACKGROUND`] | |
439/// | [`TEXT`](SDL_MessageBoxColorType::TEXT) | [`SDL_MESSAGEBOX_COLOR_TEXT`] | |
440/// | [`BUTTON_BORDER`](SDL_MessageBoxColorType::BUTTON_BORDER) | [`SDL_MESSAGEBOX_COLOR_BUTTON_BORDER`] | |
441/// | [`BUTTON_BACKGROUND`](SDL_MessageBoxColorType::BUTTON_BACKGROUND) | [`SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND`] | |
442/// | [`BUTTON_SELECTED`](SDL_MessageBoxColorType::BUTTON_SELECTED) | [`SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED`] | |
443/// | [`COUNT`](SDL_MessageBoxColorType::COUNT) | [`SDL_MESSAGEBOX_COLOR_COUNT`] | Size of the colors array of [`SDL_MessageBoxColorScheme`]. |
444#[repr(transparent)]
445#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
446pub struct SDL_MessageBoxColorType(pub ::core::ffi::c_int);
447
448impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_MessageBoxColorType {
449    #[inline(always)]
450    fn eq(&self, other: &::core::ffi::c_int) -> bool {
451        &self.0 == other
452    }
453}
454
455impl ::core::cmp::PartialEq<SDL_MessageBoxColorType> for ::core::ffi::c_int {
456    #[inline(always)]
457    fn eq(&self, other: &SDL_MessageBoxColorType) -> bool {
458        self == &other.0
459    }
460}
461
462impl From<SDL_MessageBoxColorType> for ::core::ffi::c_int {
463    #[inline(always)]
464    fn from(value: SDL_MessageBoxColorType) -> Self {
465        value.0
466    }
467}
468
469#[cfg(feature = "debug-impls")]
470impl ::core::fmt::Debug for SDL_MessageBoxColorType {
471    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
472        #[allow(unreachable_patterns)]
473        f.write_str(match *self {
474            Self::BACKGROUND => "SDL_MESSAGEBOX_COLOR_BACKGROUND",
475            Self::TEXT => "SDL_MESSAGEBOX_COLOR_TEXT",
476            Self::BUTTON_BORDER => "SDL_MESSAGEBOX_COLOR_BUTTON_BORDER",
477            Self::BUTTON_BACKGROUND => "SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND",
478            Self::BUTTON_SELECTED => "SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED",
479            Self::COUNT => "SDL_MESSAGEBOX_COLOR_COUNT",
480
481            _ => return write!(f, "SDL_MessageBoxColorType({})", self.0),
482        })
483    }
484}
485
486impl SDL_MessageBoxColorType {
487    pub const BACKGROUND: Self = Self((0 as ::core::ffi::c_int));
488    pub const TEXT: Self = Self((1 as ::core::ffi::c_int));
489    pub const BUTTON_BORDER: Self = Self((2 as ::core::ffi::c_int));
490    pub const BUTTON_BACKGROUND: Self = Self((3 as ::core::ffi::c_int));
491    pub const BUTTON_SELECTED: Self = Self((4 as ::core::ffi::c_int));
492    /// Size of the colors array of [`SDL_MessageBoxColorScheme`].
493    pub const COUNT: Self = Self((5 as ::core::ffi::c_int));
494}
495
496pub const SDL_MESSAGEBOX_COLOR_BACKGROUND: SDL_MessageBoxColorType =
497    SDL_MessageBoxColorType::BACKGROUND;
498pub const SDL_MESSAGEBOX_COLOR_TEXT: SDL_MessageBoxColorType = SDL_MessageBoxColorType::TEXT;
499pub const SDL_MESSAGEBOX_COLOR_BUTTON_BORDER: SDL_MessageBoxColorType =
500    SDL_MessageBoxColorType::BUTTON_BORDER;
501pub const SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND: SDL_MessageBoxColorType =
502    SDL_MessageBoxColorType::BUTTON_BACKGROUND;
503pub const SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED: SDL_MessageBoxColorType =
504    SDL_MessageBoxColorType::BUTTON_SELECTED;
505/// Size of the colors array of [`SDL_MessageBoxColorScheme`].
506pub const SDL_MESSAGEBOX_COLOR_COUNT: SDL_MessageBoxColorType = SDL_MessageBoxColorType::COUNT;
507
508impl SDL_MessageBoxColorType {
509    /// Initialize a `SDL_MessageBoxColorType` from a raw value.
510    #[inline(always)]
511    pub const fn new(value: ::core::ffi::c_int) -> Self {
512        Self(value)
513    }
514}
515
516impl SDL_MessageBoxColorType {
517    /// Get a copy of the inner raw value.
518    #[inline(always)]
519    pub const fn value(&self) -> ::core::ffi::c_int {
520        self.0
521    }
522}
523
524#[cfg(feature = "metadata")]
525impl sdl3_sys::metadata::GroupMetadata for SDL_MessageBoxColorType {
526    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
527        &crate::metadata::messagebox::METADATA_SDL_MessageBoxColorType;
528}
529
530/// A set of colors to use for message box dialogs
531///
532/// ## Availability
533/// This struct is available since SDL 3.2.0.
534#[repr(C)]
535#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
536#[cfg_attr(feature = "debug-impls", derive(Debug))]
537pub struct SDL_MessageBoxColorScheme {
538    pub colors: [SDL_MessageBoxColor; SDL_MESSAGEBOX_COLOR_COUNT.0 as ::core::primitive::usize],
539}
540
541/// MessageBox structure containing title, text, window, etc.
542///
543/// ## Availability
544/// This struct is available since SDL 3.2.0.
545#[repr(C)]
546#[cfg_attr(feature = "debug-impls", derive(Debug))]
547pub struct SDL_MessageBoxData {
548    pub flags: SDL_MessageBoxFlags,
549    /// Parent window, can be NULL
550    pub window: *mut SDL_Window,
551    /// UTF-8 title
552    pub title: *const ::core::ffi::c_char,
553    /// UTF-8 message text
554    pub message: *const ::core::ffi::c_char,
555    pub numbuttons: ::core::ffi::c_int,
556    pub buttons: *const SDL_MessageBoxButtonData,
557    /// [`SDL_MessageBoxColorScheme`], can be NULL to use system settings
558    pub colorScheme: *const SDL_MessageBoxColorScheme,
559}
560
561impl ::core::default::Default for SDL_MessageBoxData {
562    /// Initialize all fields to zero
563    #[inline(always)]
564    fn default() -> Self {
565        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
566    }
567}
568
569unsafe extern "C" {
570    /// Create a modal message box.
571    ///
572    /// If your needs aren't complex, it might be easier to use
573    /// [`SDL_ShowSimpleMessageBox`].
574    ///
575    /// This function should be called on the thread that created the parent
576    /// window, or on the main thread if the messagebox has no parent. It will
577    /// block execution of that thread until the user clicks a button or closes the
578    /// messagebox.
579    ///
580    /// This function may be called at any time, even before [`SDL_Init()`]. This makes
581    /// it useful for reporting errors like a failure to create a renderer or
582    /// OpenGL context.
583    ///
584    /// On X11, SDL rolls its own dialog box with X11 primitives instead of a
585    /// formal toolkit like GTK+ or Qt.
586    ///
587    /// Note that if [`SDL_Init()`] would fail because there isn't any available video
588    /// target, this function is likely to fail for the same reasons. If this is a
589    /// concern, check the return value from this function and fall back to writing
590    /// to stderr if you can.
591    ///
592    /// ## Parameters
593    /// - `messageboxdata`: the [`SDL_MessageBoxData`] structure with title, text and
594    ///   other options.
595    /// - `buttonid`: the pointer to which user id of hit button should be
596    ///   copied.
597    ///
598    /// ## Return value
599    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
600    ///   information.
601    ///
602    /// ## Thread safety
603    /// This function should only be called on the main thread.
604    ///
605    /// ## Availability
606    /// This function is available since SDL 3.2.0.
607    ///
608    /// ## See also
609    /// - [`SDL_ShowSimpleMessageBox`]
610    pub fn SDL_ShowMessageBox(
611        messageboxdata: *const SDL_MessageBoxData,
612        buttonid: *mut ::core::ffi::c_int,
613    ) -> ::core::primitive::bool;
614}
615
616unsafe extern "C" {
617    /// Display a simple modal message box.
618    ///
619    /// If your needs aren't complex, this function is preferred over
620    /// [`SDL_ShowMessageBox`].
621    ///
622    /// `flags` may be any of the following:
623    ///
624    /// - [`SDL_MESSAGEBOX_ERROR`]\: error dialog
625    /// - [`SDL_MESSAGEBOX_WARNING`]\: warning dialog
626    /// - [`SDL_MESSAGEBOX_INFORMATION`]\: informational dialog
627    ///
628    /// This function should be called on the thread that created the parent
629    /// window, or on the main thread if the messagebox has no parent. It will
630    /// block execution of that thread until the user clicks a button or closes the
631    /// messagebox.
632    ///
633    /// This function may be called at any time, even before [`SDL_Init()`]. This makes
634    /// it useful for reporting errors like a failure to create a renderer or
635    /// OpenGL context.
636    ///
637    /// On X11, SDL rolls its own dialog box with X11 primitives instead of a
638    /// formal toolkit like GTK+ or Qt.
639    ///
640    /// Note that if [`SDL_Init()`] would fail because there isn't any available video
641    /// target, this function is likely to fail for the same reasons. If this is a
642    /// concern, check the return value from this function and fall back to writing
643    /// to stderr if you can.
644    ///
645    /// ## Parameters
646    /// - `flags`: an [`SDL_MessageBoxFlags`] value.
647    /// - `title`: UTF-8 title text.
648    /// - `message`: UTF-8 message text.
649    /// - `window`: the parent window, or NULL for no parent.
650    ///
651    /// ## Return value
652    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
653    ///   information.
654    ///
655    /// ## Thread safety
656    /// This function should only be called on the main thread.
657    ///
658    /// ## Availability
659    /// This function is available since SDL 3.2.0.
660    ///
661    /// ## See also
662    /// - [`SDL_ShowMessageBox`]
663    pub fn SDL_ShowSimpleMessageBox(
664        flags: SDL_MessageBoxFlags,
665        title: *const ::core::ffi::c_char,
666        message: *const ::core::ffi::c_char,
667        window: *mut SDL_Window,
668    ) -> ::core::primitive::bool;
669}
670
671#[cfg(doc)]
672use crate::everything::*;