Implementation of GFX2_MessageBox() for SDL1.2.x and Mac OS X
This commit is contained in:
parent
b0f1117bbc
commit
9c7057eab7
@ -102,6 +102,10 @@ int GFX2_GetScreenSize(int * width, int * height);
|
|||||||
#define GFX2_MB_INFO MB_OK
|
#define GFX2_MB_INFO MB_OK
|
||||||
#define GFX2_MB_ERROR (MB_OK|MB_ICONERROR)
|
#define GFX2_MB_ERROR (MB_OK|MB_ICONERROR)
|
||||||
#define GFX2_MB_WARNING (MB_OK|MB_ICONWARNING)
|
#define GFX2_MB_WARNING (MB_OK|MB_ICONWARNING)
|
||||||
|
#elif defined(__macosx__)
|
||||||
|
#define GFX2_MB_INFO (unsigned)kCFUserNotificationPlainAlertLevel
|
||||||
|
#define GFX2_MB_ERROR (unsigned)kCFUserNotificationStopAlertLevel
|
||||||
|
#define GFX2_MB_WARNING (unsigned)kCFUserNotificationCautionAlertLevel
|
||||||
#else
|
#else
|
||||||
#define GFX2_MB_INFO 1
|
#define GFX2_MB_INFO 1
|
||||||
#define GFX2_MB_ERROR 2
|
#define GFX2_MB_ERROR 2
|
||||||
|
|||||||
@ -34,6 +34,9 @@
|
|||||||
#ifndef __GP2X__
|
#ifndef __GP2X__
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__macosx__)
|
||||||
|
#import <CoreFoundation/CoreFoundation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "sdlscreen.h"
|
#include "sdlscreen.h"
|
||||||
@ -803,6 +806,20 @@ int GFX2_MessageBox(const char * text, const char * caption, unsigned int type)
|
|||||||
return SDL_ShowSimpleMessageBox(type, caption, text, Window_SDL);
|
return SDL_ShowSimpleMessageBox(type, caption, text, Window_SDL);
|
||||||
#elif defined(WIN32)
|
#elif defined(WIN32)
|
||||||
return MessageBoxA(GFX2_Get_Window_Handle(), text, caption, type);
|
return MessageBoxA(GFX2_Get_Window_Handle(), text, caption, type);
|
||||||
#endif
|
#elif defined(__macosx__)
|
||||||
// TODO : display for MacOS : http://blog.jorgearimany.com/2010/05/messagebox-from-windows-to-mac.html
|
// TODO : display for MacOS : http://blog.jorgearimany.com/2010/05/messagebox-from-windows-to-mac.html
|
||||||
|
int r;
|
||||||
|
CFOptionFlags result;
|
||||||
|
CFStringRef text_ref = CFStringCreateWithCString(NULL, text, strlen(text));
|
||||||
|
CFStringRef caption_ref = CFStringCreateWithCString(NULL, caption, strlen(text));
|
||||||
|
r = CFUserNotificationDisplayAlert(0, (CFOptionFlags)type,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
caption_ref, text_ref,
|
||||||
|
NULL, NULL, NULL, &result);
|
||||||
|
CFRelease(text_ref);
|
||||||
|
CFRelease(caption_ref);
|
||||||
|
return (r == 0);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user