1use super::stdinc::*;
15
16use super::error::*;
17
18use super::video::*;
19
20#[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 pub const ERROR: Self = Self((0x00000010 as Uint32));
184 pub const WARNING: Self = Self((0x00000020 as Uint32));
186 pub const INFORMATION: Self = Self((0x00000040 as Uint32));
188 pub const BUTTONS_LEFT_TO_RIGHT: Self = Self((0x00000080 as Uint32));
190 pub const BUTTONS_RIGHT_TO_LEFT: Self = Self((0x00000100 as Uint32));
192}
193
194pub const SDL_MESSAGEBOX_ERROR: SDL_MessageBoxFlags = SDL_MessageBoxFlags::ERROR;
196pub const SDL_MESSAGEBOX_WARNING: SDL_MessageBoxFlags = SDL_MessageBoxFlags::WARNING;
198pub const SDL_MESSAGEBOX_INFORMATION: SDL_MessageBoxFlags = SDL_MessageBoxFlags::INFORMATION;
200pub const SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT: SDL_MessageBoxFlags =
202 SDL_MessageBoxFlags::BUTTONS_LEFT_TO_RIGHT;
203pub const SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT: SDL_MessageBoxFlags =
205 SDL_MessageBoxFlags::BUTTONS_RIGHT_TO_LEFT;
206
207impl SDL_MessageBoxFlags {
208 #[inline(always)]
210 pub const fn new(value: Uint32) -> Self {
211 Self(value)
212 }
213}
214
215impl SDL_MessageBoxFlags {
216 #[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#[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 pub const RETURNKEY_DEFAULT: Self = Self((0x00000001 as Uint32));
363 pub const ESCAPEKEY_DEFAULT: Self = Self((0x00000002 as Uint32));
365}
366
367pub const SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT: SDL_MessageBoxButtonFlags =
369 SDL_MessageBoxButtonFlags::RETURNKEY_DEFAULT;
370pub const SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT: SDL_MessageBoxButtonFlags =
372 SDL_MessageBoxButtonFlags::ESCAPEKEY_DEFAULT;
373
374impl SDL_MessageBoxButtonFlags {
375 #[inline(always)]
377 pub const fn new(value: Uint32) -> Self {
378 Self(value)
379 }
380}
381
382impl SDL_MessageBoxButtonFlags {
383 #[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#[repr(C)]
401#[derive(Clone, Copy)]
402#[cfg_attr(feature = "debug-impls", derive(Debug))]
403pub struct SDL_MessageBoxButtonData {
404 pub flags: SDL_MessageBoxButtonFlags,
405 pub buttonID: ::core::ffi::c_int,
407 pub text: *const ::core::ffi::c_char,
409}
410
411impl ::core::default::Default for SDL_MessageBoxButtonData {
412 #[inline(always)]
414 fn default() -> Self {
415 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
416 }
417}
418
419#[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#[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 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;
505pub const SDL_MESSAGEBOX_COLOR_COUNT: SDL_MessageBoxColorType = SDL_MessageBoxColorType::COUNT;
507
508impl SDL_MessageBoxColorType {
509 #[inline(always)]
511 pub const fn new(value: ::core::ffi::c_int) -> Self {
512 Self(value)
513 }
514}
515
516impl SDL_MessageBoxColorType {
517 #[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#[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#[repr(C)]
546#[cfg_attr(feature = "debug-impls", derive(Debug))]
547pub struct SDL_MessageBoxData {
548 pub flags: SDL_MessageBoxFlags,
549 pub window: *mut SDL_Window,
551 pub title: *const ::core::ffi::c_char,
553 pub message: *const ::core::ffi::c_char,
555 pub numbuttons: ::core::ffi::c_int,
556 pub buttons: *const SDL_MessageBoxButtonData,
557 pub colorScheme: *const SDL_MessageBoxColorScheme,
559}
560
561impl ::core::default::Default for SDL_MessageBoxData {
562 #[inline(always)]
564 fn default() -> Self {
565 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
566 }
567}
568
569unsafe extern "C" {
570 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 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::*;