sdlmessagebox.inc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //from "sdl_messagebox.h"
  2. {**
  3. * SDL_MessageBox flags. If supported will display warning icon, etc.
  4. *}
  5. type
  6. PPSDL_MessageBoxFlags = ^PSDL_MessageBoxFlags;
  7. PSDL_MessageBoxFlags = ^TSDL_MessageBoxFlags;
  8. TSDL_MessageBoxFlags = type cuint32;
  9. const
  10. SDL_MESSAGEBOX_ERROR = TSDL_MessageBoxFlags($00000010); {**< error dialog *}
  11. SDL_MESSAGEBOX_WARNING = TSDL_MessageBoxFlags($00000020); {**< warning dialog *}
  12. SDL_MESSAGEBOX_INFORMATION = TSDL_MessageBoxFlags($00000040); {**< informational dialog *}
  13. SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = TSDL_MessageBoxFlags($00000080); {/**< buttons placed left to right */}
  14. SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = TSDL_MessageBoxFlags($00000100); {/**< buttons placed right to left */}
  15. {**
  16. * Flags for SDL_MessageBoxButtonData.
  17. *}
  18. type
  19. PPSDL_MessageBoxButtonFlags = ^PSDL_MessageBoxButtonFlags;
  20. PSDL_MessageBoxButtonFlags = ^TSDL_MessageBoxButtonFlags;
  21. TSDL_MessageBoxButtonFlags = type cuint32;
  22. const
  23. SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000001); {**< Marks the default button when return is hit *}
  24. SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000002); {**< Marks the default button when escape is hit *}
  25. {**
  26. * Individual button data.
  27. *}
  28. type
  29. PPSDL_MessageBoxButtonData = ^PSDL_MessageBoxButtonData;
  30. PSDL_MessageBoxButtonData = ^TSDL_MessageBoxButtonData;
  31. TSDL_MessageBoxButtonData = record
  32. flags: TSDL_MessageBoxButtonFlags; {**< ::SDL_MessageBoxButtonFlags *}
  33. buttonid: cint; {**< User defined button id (value returned via SDL_ShowMessageBox) *}
  34. text: PAnsiChar; {**< The UTF-8 button text *}
  35. end;
  36. {**
  37. * RGB value used in a message box color scheme
  38. *}
  39. type
  40. PPSDL_MessageBoxColor = ^PSDL_MessageBoxColor;
  41. PSDL_MessageBoxColor = ^TSDL_MessageBoxColor;
  42. TSDL_MessageBoxColor = record
  43. r, g, b: cuint8;
  44. end;
  45. PPSDL_MessageBoxColorType = ^PSDL_MessageBoxColorType;
  46. PSDL_MessageBoxColorType = ^TSDL_MessageBoxColorType;
  47. TSDL_MessageBoxColorType = type Word;
  48. const
  49. SDL_MESSAGEBOX_COLOR_BACKGROUND = TSDL_MessageBoxColorType(0);
  50. SDL_MESSAGEBOX_COLOR_TEXT = TSDL_MessageBoxColorType(1);
  51. SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = TSDL_MessageBoxColorType(2);
  52. SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = TSDL_MessageBoxColorType(3);
  53. SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = TSDL_MessageBoxColorType(4);
  54. SDL_MESSAGEBOX_COLOR_MAX = TSDL_MessageBoxColorType(5);
  55. {**
  56. * A set of colors to use for message box dialogs
  57. *}
  58. type
  59. PPSDL_MessageBoxColorScheme = ^PSDL_MessageBoxColorScheme;
  60. PSDL_MessageBoxColorScheme = ^TSDL_MessageBoxColorScheme;
  61. TSDL_MessageBoxColorScheme = record
  62. colors: array[0..SDL_MESSAGEBOX_COLOR_MAX-1] of TSDL_MessageBoxColor;
  63. end;
  64. {**
  65. * MessageBox structure containing title, text, window, etc.
  66. *}
  67. type
  68. PPSDL_MessageBoxData = ^PSDL_MessageBoxData;
  69. PSDL_MessageBoxData = ^TSDL_MessageBoxData;
  70. TSDL_MessageBoxData = record
  71. flags: TSDL_MessageBoxFlags; {**< SDL_MessageBoxFlags *}
  72. window: PSDL_Window; {**< Parent window, can be NULL *}
  73. title: PAnsiChar; {**< UTF-8 title *}
  74. _message: PAnsiChar; {**< UTF-8 message text *}
  75. numbuttons: cint;
  76. buttons: PSDL_MessageBoxButtonData;
  77. colorScheme: PSDL_MessageBoxColorScheme; {**< SDL_MessageBoxColorScheme, can be NULL to use system settings *}
  78. end;
  79. {**
  80. * Create a modal message box.
  81. *
  82. * messageboxdata The SDL_MessageBoxData structure with title, text, etc.
  83. * buttonid The pointer to which user id of hit button should be copied.
  84. *
  85. * -1 on error, otherwise 0 and buttonid contains user id of button
  86. * hit or -1 if dialog was closed.
  87. *
  88. * This function should be called on the thread that created the parent
  89. * window, or on the main thread if the messagebox has no parent. It will
  90. * block execution of that thread until the user clicks a button or
  91. * closes the messagebox.
  92. *}
  93. function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl;
  94. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowMessageBox' {$ENDIF} {$ENDIF};
  95. {**
  96. * Create a simple modal message box
  97. *
  98. * flags SDL_MessageBoxFlags
  99. * title UTF-8 title text
  100. * message UTF-8 message text
  101. * window The parent window, or NULL for no parent
  102. *
  103. * 0 on success, -1 on error
  104. *
  105. * SDL_ShowMessageBox
  106. *}
  107. function SDL_ShowSimpleMessageBox(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl;
  108. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowSimpleMessageBox' {$ENDIF} {$ENDIF};