SDL standard library

Dependents:   H261_encoder

Committer:
miruga27
Date:
Wed Sep 07 18:46:53 2016 +0000
Revision:
0:dda4f4550403
7/09/2016;

Who changed what in which revision?

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