1 /+ 2 + Copyright 2022 – 2024 Aya Partridge 3 + Copyright 2018 - 2022 Michael D. Parker 4 + Distributed under the Boost Software License, Version 1.0. 5 + (See accompanying file LICENSE_1_0.txt or copy at 6 + http://www.boost.org/LICENSE_1_0.txt) 7 +/ 8 module sdl.messagebox; 9 10 import bindbc.sdl.config; 11 import bindbc.sdl.codegen; 12 13 import sdl.video; 14 15 alias SDL_MessageBoxFlags = uint; 16 enum: SDL_MessageBoxFlags{ 17 SDL_MESSAGEBOX_ERROR = 0x0000_0010, 18 SDL_MESSAGEBOX_WARNING = 0x0000_0020, 19 SDL_MESSAGEBOX_INFORMATION = 0x0000_0040, 20 } 21 static if(sdlSupport >= SDLSupport.v2_0_12) 22 enum: SDL_MessageBoxFlags{ 23 SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x0000_0080, 24 SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x0000_0100, 25 } 26 27 alias SDL_MessageBoxButtonFlags = uint; 28 enum: SDL_MessageBoxButtonFlags{ 29 SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x000_00001, 30 SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x000_00002, 31 } 32 33 struct SDL_MessageBoxButtonData{ 34 uint flags; 35 int buttonid; 36 const(char)* text; 37 } 38 39 struct SDL_MessageBoxColor{ 40 ubyte r, g, b; 41 } 42 alias SDL_MessageBoxColour = SDL_MessageBoxColor; 43 44 alias SDL_MessageBoxColorType = uint; 45 enum: SDL_MessageBoxColorType{ 46 SDL_MESSAGEBOX_COLOR_BACKGROUND = 0, 47 SDL_MESSAGEBOX_COLOUR_BACKGROUND = SDL_MESSAGEBOX_COLOR_BACKGROUND, 48 SDL_MESSAGEBOX_COLOR_TEXT = 1, 49 SDL_MESSAGEBOX_COLOUR_TEXT = SDL_MESSAGEBOX_COLOR_TEXT, 50 SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = 2, 51 SDL_MESSAGEBOX_COLOUR_BUTTON_BORDER = SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, 52 SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3, 53 SDL_MESSAGEBOX_COLOUR_BUTTON_BACKGROUND = SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, 54 SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = 4, 55 SDL_MESSAGEBOX_COLOUR_BUTTON_SELECTED = SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, 56 SDL_MESSAGEBOX_COLOR_MAX = 5, 57 SDL_MESSAGEBOX_COLOUR_MAX = SDL_MESSAGEBOX_COLOR_MAX, 58 } 59 alias SDL_MessageBoxColourType = SDL_MessageBoxColorType; 60 61 struct SDL_MessageBoxColorScheme{ 62 SDL_MessageBoxColor[SDL_MESSAGEBOX_COLOR_MAX] colors; 63 alias colours = colors; 64 } 65 66 struct SDL_MessageBoxData{ 67 SDL_MessageBoxFlags flags; 68 SDL_Window* window; 69 const(char)* title; 70 const(char)* message; 71 72 int numbuttons; 73 const(SDL_MessageBoxButtonData)* buttons; 74 75 const(SDL_MessageBoxColorScheme)* colorScheme; 76 alias colourScheme = colorScheme; 77 } 78 79 mixin(joinFnBinds((){ 80 FnBind[] ret = [ 81 {q{int}, q{SDL_ShowMessageBox}, q{const(SDL_MessageBoxData)* messageBoxData, int* buttonID}}, 82 {q{int}, q{SDL_ShowSimpleMessageBox}, q{SDL_MessageBoxFlags flags, const(char)* title, const(char)* messsage, SDL_Window* window}}, 83 ]; 84 return ret; 85 }()));