module lib.sdl2.messagebox

Code Map

module lib.sdl2.messagebox;


enum SDL_MESSAGEBOX_ERROR;
enum SDL_MESSAGEBOX_WARNING;
enum SDL_MESSAGEBOX_INFORMATION;
enum SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT;
enum SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
enum SDL_MESSAGEBOX_COLOR_BACKGROUND;
enum SDL_MESSAGEBOX_COLOR_TEXT;
enum SDL_MESSAGEBOX_COLOR_BUTTON_BORDER;
enum SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND;
enum SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED;
enum SDL_MESSAGEBOX_COLOR_MAX;

//! \brief SDL_MessageBox flags. If supported will display warning icon,
//! etc.
alias SDL_MessageBoxFlags = i32;
//! \brief Flags for SDL_MessageBoxButtonData.
alias SDL_MessageBoxButtonFlags = i32;
alias SDL_MessageBoxColorType = i32;

//! \brief Individual button data.
struct SDL_MessageBoxButtonData
{
public:
	flags: Uint32;
	buttonid: i32;
	text: char*;
}

//! \brief RGB value used in a message box color scheme
struct SDL_MessageBoxColor
{
public:
	r: Uint8;
	g: Uint8;
	b: Uint8;
}

//! \brief A set of colors to use for message box dialogs
struct SDL_MessageBoxColorScheme
{
public:
	colors: SDL_MessageBoxColor[6];
}

//! \brief MessageBox structure containing title, text, window, etc.
struct SDL_MessageBoxData
{
public:
	flags: Uint32;
	window: SDL_Window*;
	title: char*;
	message: char*;
	numbuttons: i32;
	buttons: SDL_MessageBoxButtonData*;
	colorScheme: SDL_MessageBoxColorScheme*;
}

//! \brief Create a modal message box.
fn SDL_ShowMessageBox(messageboxdata: const(const(SDL_MessageBoxData)*), buttonid: i32*) i32;
//! \brief Create a simple modal message box
fn SDL_ShowSimpleMessageBox(flags: Uint32, title: const(const(char)*), message: const(const(char)*), window: SDL_Window*) i32;
alias SDL_MessageBoxFlags

\brief SDL_MessageBox flags. If supported will display warning icon, etc.

alias SDL_MessageBoxButtonFlags

\brief Flags for SDL_MessageBoxButtonData.

struct SDL_MessageBoxButtonData

\brief Individual button data.

struct SDL_MessageBoxColor

\brief RGB value used in a message box color scheme

struct SDL_MessageBoxColorScheme

\brief A set of colors to use for message box dialogs

struct SDL_MessageBoxData

\brief MessageBox structure containing title, text, window, etc.

fn SDL_ShowMessageBox(messageboxdata: const(const(SDL_MessageBoxData)*), buttonid: i32*) i32

\brief Create a modal message box.

\param messageboxdata The SDL_MessageBoxData structure with title, text, etc. \param buttonid The pointer to which user id of hit button should be copied.

\return -1 on error, otherwise 0 and buttonid contains user id of button hit or -1 if dialog was closed.

\note 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.

fn SDL_ShowSimpleMessageBox(flags: Uint32, title: const(const(char)*), message: const(const(char)*), window: SDL_Window*) i32

\brief Create a simple modal message box

\param flags ::SDL_MessageBoxFlags \param title UTF-8 title text \param message UTF-8 message text \param window The parent window, or NULL for no parent

\return 0 on success, -1 on error

\sa SDL_ShowMessageBox