Support for showing error dialog

This commit is contained in:
Daniel Collin 2013-07-01 12:48:03 +02:00
parent 5e2743d9b8
commit ba0f99d51b
4 changed files with 28 additions and 1 deletions

View File

@ -4,3 +4,5 @@
int Dialog_open(text_t* dest);
int Dialog_save(text_t* dest);
void Dialog_showError(const text_t* text);

View File

@ -57,6 +57,11 @@ void Dialog_showColorPicker(unsigned int* color)
printf("dialog_showColorPicker() not implemented\n");
}
void Dialog_showError(const text_t* text)
{
printf("Error %s\n", text);
}
int mapSdlEmKeycode(SDLKey key)
{
switch (key)

View File

@ -52,6 +52,7 @@ int Dialog_save(char* dest)
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@interface ColorDelegate : NSObject<NSWindowDelegate>
{
@ -139,3 +140,15 @@ void Dialog_showColorPicker(uint32_t* color)
[thePool release];
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Dialog_showError(const text_t* text)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString* message = [[[NSString alloc] initWithUTF8String:text] autorelease];// convert
NSRunAlertPanel(@"Error", message, @"Ok", @"", @"");
[pool drain];
}

View File

@ -40,6 +40,13 @@ int Dialog_save(wchar_t* path)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Dialog_showError(const wchar_t* text)
{
MessageBox(NULL, text, L"Error", MB_ICONERROR | MB_OK);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static COLORREF custColors[16];
void Dialog_showColorPicker(unsigned int* color)