include/SDL_messagebox.h
author Ryan C. Gordon <icculus@icculus.org>
Wed, 21 Nov 2012 23:00:06 -0500
changeset 6680 9d3df1f5c542
parent 6679 9f0d4046f3d6
child 6885 700f1b25f77f
permissions -rw-r--r--
Removed some tab chars.
slouken@6602
     1
/*
slouken@6602
     2
  Simple DirectMedia Layer
slouken@6602
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
slouken@6602
     4
slouken@6602
     5
  This software is provided 'as-is', without any express or implied
slouken@6602
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@6602
     7
  arising from the use of this software.
slouken@6602
     8
slouken@6602
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@6602
    10
  including commercial applications, and to alter it and redistribute it
slouken@6602
    11
  freely, subject to the following restrictions:
slouken@6602
    12
slouken@6602
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@6602
    14
     claim that you wrote the original software. If you use this software
slouken@6602
    15
     in a product, an acknowledgment in the product documentation would be
slouken@6602
    16
     appreciated but is not required.
slouken@6602
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@6602
    18
     misrepresented as being the original software.
slouken@6602
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@6602
    20
*/
slouken@6602
    21
slouken@6602
    22
#ifndef _SDL_messagebox_h
slouken@6602
    23
#define _SDL_messagebox_h
slouken@6602
    24
slouken@6602
    25
#include "SDL_stdinc.h"
slouken@6602
    26
#include "SDL_video.h"      /* For SDL_Window */
slouken@6602
    27
slouken@6602
    28
#include "begin_code.h"
slouken@6602
    29
/* Set up for C function definitions, even when using C++ */
slouken@6602
    30
#ifdef __cplusplus
slouken@6602
    31
/* *INDENT-OFF* */
slouken@6602
    32
extern "C" {
slouken@6602
    33
/* *INDENT-ON* */
slouken@6602
    34
#endif
slouken@6602
    35
slouken@6602
    36
/**
slouken@6602
    37
 * \brief SDL_MessageBox flags. If supported will display warning icon, etc.
slouken@6602
    38
 */
slouken@6602
    39
typedef enum
slouken@6602
    40
{
slouken@6602
    41
    SDL_MESSAGEBOX_ERROR        = 0x00000010,   /**< error dialog */
slouken@6602
    42
    SDL_MESSAGEBOX_WARNING      = 0x00000020,   /**< warning dialog */
icculus@6679
    43
    SDL_MESSAGEBOX_INFORMATION  = 0x00000040    /**< informational dialog */
slouken@6602
    44
} SDL_MessageBoxFlags;
slouken@6602
    45
slouken@6602
    46
/**
slouken@6602
    47
 * \brief Flags for SDL_MessageBoxButtonData.
slouken@6602
    48
 */
slouken@6602
    49
typedef enum
slouken@6602
    50
{
slouken@6602
    51
    SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001,  /**< Marks the default button when return is hit */
icculus@6679
    52
    SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002   /**< Marks the default button when escape is hit */
slouken@6602
    53
} SDL_MessageBoxButtonFlags;
slouken@6602
    54
slouken@6602
    55
/**
slouken@6602
    56
 *  \brief Individual button data.
slouken@6602
    57
 */
slouken@6602
    58
typedef struct
slouken@6602
    59
{
slouken@6602
    60
    Uint32 flags;       /**< ::SDL_MessageBoxButtonFlags */
slouken@6602
    61
    int buttonid;       /**< User defined button id (value returned via SDL_MessageBox) */
slouken@6602
    62
    const char * text;  /**< The UTF-8 button text */
slouken@6602
    63
} SDL_MessageBoxButtonData;
slouken@6602
    64
slouken@6602
    65
/**
slouken@6602
    66
 * \brief RGB value used in a message box color scheme
slouken@6602
    67
 */
slouken@6602
    68
typedef struct
slouken@6602
    69
{
slouken@6602
    70
    Uint8 r, g, b;
slouken@6602
    71
} SDL_MessageBoxColor;
slouken@6602
    72
slouken@6602
    73
typedef enum
slouken@6602
    74
{
icculus@6680
    75
    SDL_MESSAGEBOX_COLOR_BACKGROUND,
icculus@6680
    76
    SDL_MESSAGEBOX_COLOR_TEXT,
icculus@6680
    77
    SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
icculus@6680
    78
    SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
icculus@6680
    79
    SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
icculus@6680
    80
    SDL_MESSAGEBOX_COLOR_MAX
slouken@6602
    81
} SDL_MessageBoxColorType;
slouken@6602
    82
slouken@6602
    83
/**
slouken@6602
    84
 * \brief A set of colors to use for message box dialogs
slouken@6602
    85
 */
slouken@6602
    86
typedef struct
slouken@6602
    87
{
slouken@6602
    88
    SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
slouken@6602
    89
} SDL_MessageBoxColorScheme;
slouken@6602
    90
slouken@6602
    91
/**
slouken@6602
    92
 *  \brief MessageBox structure containing title, text, window, etc.
slouken@6602
    93
 */
slouken@6602
    94
typedef struct
slouken@6602
    95
{
slouken@6602
    96
    Uint32 flags;                       /**< ::SDL_MessageBoxFlags */
slouken@6602
    97
    SDL_Window *window;                 /**< Parent window, can be NULL */
slouken@6602
    98
    const char *title;                  /**< UTF-8 title */
slouken@6602
    99
    const char *message;                /**< UTF-8 message text */
slouken@6602
   100
slouken@6602
   101
    int numbuttons;
slouken@6602
   102
    const SDL_MessageBoxButtonData *buttons;
slouken@6602
   103
slouken@6602
   104
    const SDL_MessageBoxColorScheme *colorScheme;   /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
slouken@6602
   105
} SDL_MessageBoxData;
slouken@6602
   106
slouken@6602
   107
/**
slouken@6602
   108
 *  \brief Create a modal message box.
slouken@6602
   109
 *
slouken@6602
   110
 *  \param messagebox The SDL_MessageBox structure with title, text, etc.
slouken@6602
   111
 *
slouken@6602
   112
 *  \return -1 on error, otherwise 0 and buttonid contains user id of button
slouken@6602
   113
 *          hit or -1 if dialog was closed.
slouken@6613
   114
 *
slouken@6613
   115
 *  \note This function should be called on the thread that created the parent
slouken@6613
   116
 *        window, or on the main thread if the messagebox has no parent.  It will
slouken@6613
   117
 *        block execution of that thread until the user clicks a button or
slouken@6613
   118
 *        closes the messagebox.
slouken@6602
   119
 */
slouken@6602
   120
extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
slouken@6602
   121
slouken@6602
   122
/**
slouken@6602
   123
 *  \brief Create a simple modal message box
slouken@6602
   124
 *
slouken@6602
   125
 *  \param flags    ::SDL_MessageBoxFlags
slouken@6602
   126
 *  \param title    UTF-8 title text
slouken@6602
   127
 *  \param message  UTF-8 message text
slouken@6602
   128
 *  \param window   The parent window, or NULL for no parent
slouken@6602
   129
 *
slouken@6602
   130
 *  \return 0 on success, -1 on error
slouken@6613
   131
 *
slouken@6613
   132
 *  \sa SDL_ShowMessageBox
slouken@6602
   133
 */
slouken@6602
   134
extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
slouken@6602
   135
slouken@6602
   136
slouken@6602
   137
/* Ends C function definitions when using C++ */
slouken@6602
   138
#ifdef __cplusplus
slouken@6602
   139
/* *INDENT-OFF* */
slouken@6602
   140
}
slouken@6602
   141
/* *INDENT-ON* */
slouken@6602
   142
#endif
slouken@6602
   143
#include "close_code.h"
slouken@6602
   144
slouken@6602
   145
#endif /* _SDL_messagebox_h */
slouken@6602
   146
slouken@6602
   147
/* vi: set ts=4 sw=4 expandtab: */