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
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#[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 pub const RETURNKEY_DEFAULT: Self = Self((0x00000001 as Uint32));
347 pub const ESCAPEKEY_DEFAULT: Self = Self((0x00000002 as Uint32));
349}
350
351pub const SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT: SDL_MessageBoxButtonFlags =
353 SDL_MessageBoxButtonFlags::RETURNKEY_DEFAULT;
354pub 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#[repr(C)]
369#[derive(Clone, Copy)]
370#[cfg_attr(feature = "debug-impls", derive(Debug))]
371pub struct SDL_MessageBoxButtonData {
372 pub flags: SDL_MessageBoxButtonFlags,
373 pub buttonID: ::core::ffi::c_int,
375 pub text: *const ::core::ffi::c_char,
377}
378
379impl ::core::default::Default for SDL_MessageBoxButtonData {
380 #[inline(always)]
382 fn default() -> Self {
383 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
384 }
385}
386
387#[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#[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 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;
473pub 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#[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#[repr(C)]
498#[cfg_attr(feature = "debug-impls", derive(Debug))]
499pub struct SDL_MessageBoxData {
500 pub flags: SDL_MessageBoxFlags,
501 pub window: *mut SDL_Window,
503 pub title: *const ::core::ffi::c_char,
505 pub message: *const ::core::ffi::c_char,
507 pub numbuttons: ::core::ffi::c_int,
508 pub buttons: *const SDL_MessageBoxButtonData,
509 pub colorScheme: *const SDL_MessageBoxColorScheme,
511}
512
513impl ::core::default::Default for SDL_MessageBoxData {
514 #[inline(always)]
516 fn default() -> Self {
517 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
518 }
519}
520
521unsafe extern "C" {
522 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 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::*;