include/SDL_messagebox.h
changeset 6602 533131e24aeb
child 6613 0a8672b04b00
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/SDL_messagebox.h	Tue Oct 23 17:11:22 2012 -0700
     1.3 @@ -0,0 +1,140 @@
     1.4 +/*
     1.5 +  Simple DirectMedia Layer
     1.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     1.7 +
     1.8 +  This software is provided 'as-is', without any express or implied
     1.9 +  warranty.  In no event will the authors be held liable for any damages
    1.10 +  arising from the use of this software.
    1.11 +
    1.12 +  Permission is granted to anyone to use this software for any purpose,
    1.13 +  including commercial applications, and to alter it and redistribute it
    1.14 +  freely, subject to the following restrictions:
    1.15 +
    1.16 +  1. The origin of this software must not be misrepresented; you must not
    1.17 +     claim that you wrote the original software. If you use this software
    1.18 +     in a product, an acknowledgment in the product documentation would be
    1.19 +     appreciated but is not required.
    1.20 +  2. Altered source versions must be plainly marked as such, and must not be
    1.21 +     misrepresented as being the original software.
    1.22 +  3. This notice may not be removed or altered from any source distribution.
    1.23 +*/
    1.24 +
    1.25 +#ifndef _SDL_messagebox_h
    1.26 +#define _SDL_messagebox_h
    1.27 +
    1.28 +#include "SDL_stdinc.h"
    1.29 +#include "SDL_video.h"      /* For SDL_Window */
    1.30 +
    1.31 +#include "begin_code.h"
    1.32 +/* Set up for C function definitions, even when using C++ */
    1.33 +#ifdef __cplusplus
    1.34 +/* *INDENT-OFF* */
    1.35 +extern "C" {
    1.36 +/* *INDENT-ON* */
    1.37 +#endif
    1.38 +
    1.39 +/**
    1.40 + * \brief SDL_MessageBox flags. If supported will display warning icon, etc.
    1.41 + */
    1.42 +typedef enum
    1.43 +{
    1.44 +    SDL_MESSAGEBOX_ERROR        = 0x00000010,   /**< error dialog */
    1.45 +    SDL_MESSAGEBOX_WARNING      = 0x00000020,   /**< warning dialog */
    1.46 +    SDL_MESSAGEBOX_INFORMATION  = 0x00000040,   /**< informational dialog */
    1.47 +} SDL_MessageBoxFlags;
    1.48 +
    1.49 +/**
    1.50 + * \brief Flags for SDL_MessageBoxButtonData.
    1.51 + */
    1.52 +typedef enum
    1.53 +{
    1.54 +    SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001,  /**< Marks the default button when return is hit */
    1.55 +    SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002,  /**< Marks the default button when escape is hit */
    1.56 +} SDL_MessageBoxButtonFlags;
    1.57 +
    1.58 +/**
    1.59 + *  \brief Individual button data.
    1.60 + */
    1.61 +typedef struct
    1.62 +{
    1.63 +    Uint32 flags;       /**< ::SDL_MessageBoxButtonFlags */
    1.64 +    int buttonid;       /**< User defined button id (value returned via SDL_MessageBox) */
    1.65 +    const char * text;  /**< The UTF-8 button text */
    1.66 +} SDL_MessageBoxButtonData;
    1.67 +
    1.68 +/**
    1.69 + * \brief RGB value used in a message box color scheme
    1.70 + */
    1.71 +typedef struct
    1.72 +{
    1.73 +    Uint8 r, g, b;
    1.74 +} SDL_MessageBoxColor;
    1.75 +
    1.76 +typedef enum
    1.77 +{
    1.78 +	SDL_MESSAGEBOX_COLOR_BACKGROUND,
    1.79 +	SDL_MESSAGEBOX_COLOR_TEXT,
    1.80 +	SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
    1.81 +	SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
    1.82 +	SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
    1.83 +	SDL_MESSAGEBOX_COLOR_MAX
    1.84 +} SDL_MessageBoxColorType;
    1.85 +
    1.86 +/**
    1.87 + * \brief A set of colors to use for message box dialogs
    1.88 + */
    1.89 +typedef struct
    1.90 +{
    1.91 +    SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
    1.92 +} SDL_MessageBoxColorScheme;
    1.93 +
    1.94 +/**
    1.95 + *  \brief MessageBox structure containing title, text, window, etc.
    1.96 + */
    1.97 +typedef struct
    1.98 +{
    1.99 +    Uint32 flags;                       /**< ::SDL_MessageBoxFlags */
   1.100 +    SDL_Window *window;                 /**< Parent window, can be NULL */
   1.101 +    const char *title;                  /**< UTF-8 title */
   1.102 +    const char *message;                /**< UTF-8 message text */
   1.103 +
   1.104 +    int numbuttons;
   1.105 +    const SDL_MessageBoxButtonData *buttons;
   1.106 +
   1.107 +    const SDL_MessageBoxColorScheme *colorScheme;   /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
   1.108 +} SDL_MessageBoxData;
   1.109 +
   1.110 +/**
   1.111 + *  \brief Create a modal message box.
   1.112 + *
   1.113 + *  \param messagebox The SDL_MessageBox structure with title, text, etc.
   1.114 + *
   1.115 + *  \return -1 on error, otherwise 0 and buttonid contains user id of button
   1.116 + *          hit or -1 if dialog was closed.
   1.117 + */
   1.118 +extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
   1.119 +
   1.120 +/**
   1.121 + *  \brief Create a simple modal message box
   1.122 + *
   1.123 + *  \param flags    ::SDL_MessageBoxFlags
   1.124 + *  \param title    UTF-8 title text
   1.125 + *  \param message  UTF-8 message text
   1.126 + *  \param window   The parent window, or NULL for no parent
   1.127 + *
   1.128 + *  \return 0 on success, -1 on error
   1.129 + */
   1.130 +extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
   1.131 +
   1.132 +
   1.133 +/* Ends C function definitions when using C++ */
   1.134 +#ifdef __cplusplus
   1.135 +/* *INDENT-OFF* */
   1.136 +}
   1.137 +/* *INDENT-ON* */
   1.138 +#endif
   1.139 +#include "close_code.h"
   1.140 +
   1.141 +#endif /* _SDL_messagebox_h */
   1.142 +
   1.143 +/* vi: set ts=4 sw=4 expandtab: */