2010-11-28 12:02:38 +00:00
|
|
|
/*
|
|
|
|
* messagebox.c
|
|
|
|
* d1x-rebirth
|
|
|
|
*
|
|
|
|
* Display an error or warning messagebox using the OS's window server.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-30 12:46:10 +00:00
|
|
|
#include <windows.h>
|
2010-11-28 12:02:38 +00:00
|
|
|
#include "window.h"
|
|
|
|
#include "event.h"
|
|
|
|
#include "messagebox.h"
|
|
|
|
|
|
|
|
void display_win32_alert(char *message, int error)
|
|
|
|
{
|
|
|
|
d_event event = { EVENT_WINDOW_DEACTIVATED };
|
|
|
|
window *wind;
|
|
|
|
|
|
|
|
// Handle Descent's windows properly
|
|
|
|
if ((wind = window_get_front()))
|
|
|
|
window_send_event(window_get_front(), &event);
|
|
|
|
event.type = EVENT_WINDOW_ACTIVATED;
|
|
|
|
|
2010-11-30 12:46:10 +00:00
|
|
|
if (gr_check_fullscreen())
|
|
|
|
gr_toggle_fullscreen();
|
|
|
|
|
|
|
|
MessageBox(NULL, message, error?"Sorry, a critical error has occurred.":"Attention!", error?MB_OK|MB_ICONERROR:MB_OK|MB_ICONWARNING);
|
2010-11-28 12:02:38 +00:00
|
|
|
|
|
|
|
if (wind)
|
|
|
|
window_send_event(window_get_front(), &event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void msgbox_warning(char *message)
|
|
|
|
{
|
|
|
|
display_win32_alert(message, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void msgbox_error(char *message)
|
|
|
|
{
|
|
|
|
display_win32_alert(message, 1);
|
|
|
|
}
|