mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
Use SDL_MessageBoxFlags and SDL_MessageBoxButtonFlags appropriately
This commit is contained in:
@@ -5098,7 +5098,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
return retval;
|
||||
}
|
||||
|
||||
int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
|
||||
int SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window)
|
||||
{
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
/* !!! FIXME: propose a browser API for this, get this #ifdef out of here? */
|
||||
|
@@ -154,7 +154,7 @@ class HAIKU_SDL_MessageBox : public BAlert
|
||||
(aMessageBoxData->message[0]) ?
|
||||
SetMessageText(aMessageBoxData->message) : SetMessageText(HAIKU_SDL_DefMessage);
|
||||
|
||||
SetType(ConvertMessageBoxType(static_cast<SDL_MessageBoxFlags>(aMessageBoxData->flags)));
|
||||
SetType(ConvertMessageBoxType(aMessageBoxData->flags));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -264,23 +264,12 @@ class HAIKU_SDL_MessageBox : public BAlert
|
||||
|
||||
size_t countButtons = fButtons.size();
|
||||
for (size_t i = 0; i < countButtons; ++i) {
|
||||
switch (fButtons[i]->flags)
|
||||
{
|
||||
case SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT:
|
||||
{
|
||||
fCloseButton = static_cast<int>(i);
|
||||
break;
|
||||
}
|
||||
case SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT:
|
||||
{
|
||||
fDefaultButton = static_cast<int>(i);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fButtons[i]->flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
|
||||
fCloseButton = static_cast<int>(i);
|
||||
}
|
||||
if (fButtons[i]->flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) {
|
||||
fDefaultButton = static_cast<int>(i);
|
||||
}
|
||||
AddButton(fButtons[i]->text);
|
||||
}
|
||||
|
||||
|
@@ -39,9 +39,9 @@ int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonI
|
||||
regs.r[0] = (unsigned int)&error;
|
||||
|
||||
regs.r[1] = (1 << 8) | (1 << 4);
|
||||
if (messageboxdata->flags == SDL_MESSAGEBOX_INFORMATION) {
|
||||
if (messageboxdata->flags & SDL_MESSAGEBOX_INFORMATION) {
|
||||
regs.r[1] |= (1 << 9);
|
||||
} else if (messageboxdata->flags == SDL_MESSAGEBOX_WARNING) {
|
||||
} else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) {
|
||||
regs.r[1] |= (2 << 9);
|
||||
}
|
||||
|
||||
|
@@ -166,7 +166,7 @@ int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *button
|
||||
* We need to handle it gracefully, otherwise no message box will be shown.
|
||||
*/
|
||||
argv[argc++] = zenity_major > 3 || (zenity_major == 3 && zenity_minor >= 90) ? "--icon" : "--icon-name";
|
||||
switch (messageboxdata->flags) {
|
||||
switch (messageboxdata->flags & (SDL_MESSAGEBOX_ERROR | SDL_MESSAGEBOX_WARNING | SDL_MESSAGEBOX_INFORMATION)) {
|
||||
case SDL_MESSAGEBOX_ERROR:
|
||||
argv[argc++] = "dialog-error";
|
||||
break;
|
||||
|
@@ -238,7 +238,7 @@ typedef struct
|
||||
WORD numbuttons;
|
||||
} WIN_DialogData;
|
||||
|
||||
static SDL_bool GetButtonIndex(const SDL_MessageBoxData *messageboxdata, Uint32 flags, size_t *i)
|
||||
static SDL_bool GetButtonIndex(const SDL_MessageBoxData *messageboxdata, SDL_MessageBoxButtonFlags flags, size_t *i)
|
||||
{
|
||||
for (*i = 0; *i < (size_t)messageboxdata->numbuttons; ++*i) {
|
||||
if (messageboxdata->buttons[*i].flags & flags) {
|
||||
@@ -701,7 +701,7 @@ static int WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *
|
||||
return SDL_SetError("Number of buttons exceeds limit of %d", MAX_BUTTONS);
|
||||
}
|
||||
|
||||
switch (messageboxdata->flags) {
|
||||
switch (messageboxdata->flags & (SDL_MESSAGEBOX_ERROR | SDL_MESSAGEBOX_WARNING | SDL_MESSAGEBOX_INFORMATION)) {
|
||||
case SDL_MESSAGEBOX_ERROR:
|
||||
icon = (Uint16)(size_t)IDI_ERROR;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user