| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Messagebox
Contents
Description
SDL offers a simple message box API, which is useful for simple alerts, such as informing the user when something fatal happens at startup without the need to build a UI for it (or informing the user before your UI is ready).
These message boxes are native system dialogs where possible.
There is both a customizable function () that offers lots of options for what to display and reports on what choice the user made, and also a much-simplified version (showMessageBox), merely takes a text message and title, and waits until the user presses a single "OK" UI button. Often, this is all that is necessary. Message box flags.showSimpleMessageBox
If supported will display warning icon, etc.
FFI conventions
Unsuffixed aliases are unsafe foreign imports; aliases suffixed Safe are safe. Functions whose callbacks fire during the call export only the Safe alias (the genuine unsafe import stays reachable under SDL3.Sys.Bindgen.Messagebox.Unsafe); functions curated unsafe-only export only the unsuffixed one. Each alias's documentation records its flavor and rationale.
Full conventions: SDL3.Sys.
Since: 3.2.0
Synopsis
- module SDL3.Sys.Bindgen.Messagebox
- pattern SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT :: SDL_MessageBoxButtonFlags
- pattern SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT :: SDL_MessageBoxButtonFlags
- pattern SDL_MESSAGEBOX_ERROR :: SDL_MessageBoxFlags
- pattern SDL_MESSAGEBOX_WARNING :: SDL_MessageBoxFlags
- pattern SDL_MESSAGEBOX_INFORMATION :: SDL_MessageBoxFlags
- pattern SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT :: SDL_MessageBoxFlags
- pattern SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT :: SDL_MessageBoxFlags
- showMessageBox :: PtrConst SDL_MessageBoxData -> Ptr CInt -> IO Bool
- showMessageBoxSafe :: PtrConst SDL_MessageBoxData -> Ptr CInt -> IO Bool
- showSimpleMessageBox :: SDL_MessageBoxFlags -> PtrConst CChar -> PtrConst CChar -> Ptr SDL_Window -> IO Bool
- showSimpleMessageBoxSafe :: SDL_MessageBoxFlags -> PtrConst CChar -> PtrConst CChar -> Ptr SDL_Window -> IO Bool
Documentation
module SDL3.Sys.Bindgen.Messagebox
Typed constants
pattern SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT :: SDL_MessageBoxButtonFlags Source #
Typed constant for macro SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT. Combine with .|. from Data.Bits.
pattern SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT :: SDL_MessageBoxButtonFlags Source #
Typed constant for macro SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT. Combine with .|. from Data.Bits.
pattern SDL_MESSAGEBOX_ERROR :: SDL_MessageBoxFlags Source #
Typed constant for macro SDL_MESSAGEBOX_ERROR. Combine with .|. from Data.Bits.
pattern SDL_MESSAGEBOX_WARNING :: SDL_MessageBoxFlags Source #
Typed constant for macro SDL_MESSAGEBOX_WARNING. Combine with .|. from Data.Bits.
pattern SDL_MESSAGEBOX_INFORMATION :: SDL_MessageBoxFlags Source #
Typed constant for macro SDL_MESSAGEBOX_INFORMATION. Combine with .|. from Data.Bits.
pattern SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT :: SDL_MessageBoxFlags Source #
Typed constant for macro SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT. Combine with .|. from Data.Bits.
pattern SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT :: SDL_MessageBoxFlags Source #
Typed constant for macro SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT. Combine with .|. from Data.Bits.
Function aliases
Arguments
| :: PtrConst SDL_MessageBoxData |
|
| -> Ptr CInt |
|
| -> IO Bool |
Create a modal message box.
If your needs aren't complex, it might be easier to use showSimpleMessageBox.
This function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.
This function may be called at any time, even before init. This makes it useful for reporting errors like a failure to create a renderer or OpenGL context.
On X11, SDL rolls its own dialog box with X11 primitives instead of a formal toolkit like GTK+ or Qt.
Note that if init would fail because there isn't any available video target, this function is likely to fail for the same reasons. If this is a concern, check the return value from this function and fall back to writing to stderr if you can.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
showSimpleMessageBox
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ShowMessageBox. The safe flavor isshowMessageBoxSafe: modal; blocks until dismissed. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_ShowMessageBox, defined atSDL3/SDL_messagebox.h 177:34
Since: 3.2.0
Arguments
| :: PtrConst SDL_MessageBoxData |
|
| -> Ptr CInt |
|
| -> IO Bool |
Create a modal message box.
If your needs aren't complex, it might be easier to use showSimpleMessageBox.
This function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.
This function may be called at any time, even before init. This makes it useful for reporting errors like a failure to create a renderer or OpenGL context.
On X11, SDL rolls its own dialog box with X11 primitives instead of a formal toolkit like GTK+ or Qt.
Note that if init would fail because there isn't any available video target, this function is likely to fail for the same reasons. If this is a concern, check the return value from this function and fall back to writing to stderr if you can.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
showSimpleMessageBox
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ShowMessageBox. The unsafe flavor isshowMessageBox: modal; blocks until dismissed. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_ShowMessageBox, defined atSDL3/SDL_messagebox.h 177:34
Since: 3.2.0
Arguments
| :: SDL_MessageBoxFlags |
|
| -> PtrConst CChar |
|
| -> PtrConst CChar |
|
| -> Ptr SDL_Window |
|
| -> IO Bool |
Display a simple modal message box.
If your needs aren't complex, this function is preferred over showMessageBox.
flags may be any of the following:
: error dialogsDL_MESSAGEBOX_ERROR: warning dialogsDL_MESSAGEBOX_WARNING: informational dialogsDL_MESSAGEBOX_INFORMATION
This function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.
This function may be called at any time, even before init. This makes it useful for reporting errors like a failure to create a renderer or OpenGL context.
On X11, SDL rolls its own dialog box with X11 primitives instead of a formal toolkit like GTK+ or Qt.
Note that if init would fail because there isn't any available video target, this function is likely to fail for the same reasons. If this is a concern, check the return value from this function and fall back to writing to stderr if you can.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
showMessageBox
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ShowSimpleMessageBox. The safe flavor isshowSimpleMessageBoxSafe: modal; blocks until dismissed. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_ShowSimpleMessageBox, defined atSDL3/SDL_messagebox.h 221:34
Since: 3.2.0
showSimpleMessageBoxSafe Source #
Arguments
| :: SDL_MessageBoxFlags |
|
| -> PtrConst CChar |
|
| -> PtrConst CChar |
|
| -> Ptr SDL_Window |
|
| -> IO Bool |
Display a simple modal message box.
If your needs aren't complex, this function is preferred over showMessageBox.
flags may be any of the following:
: error dialogsDL_MESSAGEBOX_ERROR: warning dialogsDL_MESSAGEBOX_WARNING: informational dialogsDL_MESSAGEBOX_INFORMATION
This function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.
This function may be called at any time, even before init. This makes it useful for reporting errors like a failure to create a renderer or OpenGL context.
On X11, SDL rolls its own dialog box with X11 primitives instead of a formal toolkit like GTK+ or Qt.
Note that if init would fail because there isn't any available video target, this function is likely to fail for the same reasons. If this is a concern, check the return value from this function and fall back to writing to stderr if you can.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
showMessageBox
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ShowSimpleMessageBox. The unsafe flavor isshowSimpleMessageBox: modal; blocks until dismissed. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_ShowSimpleMessageBox, defined atSDL3/SDL_messagebox.h 221:34
Since: 3.2.0