mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 23:22:25 +01:00
byuu says: Changelog: - restructured the project and removed a whole bunch of old/dead directives from higan/GNUmakefile - huge amounts of work on hiro/cocoa (compiles but ~70% of the functionality is commented out) - fixed a masking error in my ARM CPU disassembler [Lioncash] - SFC: decided to change board cic=(411,413) back to board region=(ntsc,pal) ... the former was too obtuse If you rename Boolean (it's a problem with an include from ruby, not from hiro) and disable all the ruby drivers, you can compile an OS X binary, but obviously it's not going to do anything. It's a boring WIP, I just wanted to push out the project structure change now at the start of this WIP cycle.
84 lines
3.1 KiB
C++
84 lines
3.1 KiB
C++
#if defined(Hiro_MessageWindow)
|
|
|
|
namespace hiro {
|
|
|
|
enum class MessageWindowType : uint { Error, Information, Question, Warning };
|
|
|
|
auto MessageWindow_dialog(MessageWindow::State& state, MessageWindowType type) -> MessageWindow::Response {
|
|
@autoreleasepool {
|
|
NSAlert* alert = [[[NSAlert alloc] init] autorelease];
|
|
if(state.title) [alert setMessageText:[NSString stringWithUTF8String:state.title]];
|
|
[alert setInformativeText:[NSString stringWithUTF8String:state.text]];
|
|
|
|
switch(state.buttons) {
|
|
case MessageWindow::Buttons::Ok:
|
|
[alert addButtonWithTitle:@"Ok"];
|
|
break;
|
|
case MessageWindow::Buttons::OkCancel:
|
|
[alert addButtonWithTitle:@"Ok"];
|
|
[alert addButtonWithTitle:@"Cancel"];
|
|
break;
|
|
case MessageWindow::Buttons::YesNo:
|
|
[alert addButtonWithTitle:@"Yes"];
|
|
[alert addButtonWithTitle:@"No"];
|
|
break;
|
|
case MessageWindow::Buttons::YesNoCancel:
|
|
[alert addButtonWithTitle:@"Yes"];
|
|
[alert addButtonWithTitle:@"No"];
|
|
[alert addButtonWithTitle:@"Cancel"];
|
|
break;
|
|
}
|
|
|
|
switch(type) {
|
|
case MessageWindowType::Error: [alert setAlertStyle:NSCriticalAlertStyle]; break;
|
|
case MessageWindowType::Information: [alert setAlertStyle:NSInformationalAlertStyle]; break;
|
|
case MessageWindowType::Question: [alert setAlertStyle:NSInformationalAlertStyle]; break;
|
|
case MessageWindowType::Warning: [alert setAlertStyle:NSWarningAlertStyle]; break;
|
|
}
|
|
|
|
NSInteger response = [alert runModal];
|
|
//[alert beginSheetModalForWindow:parent.p.cocoaWindow modalDelegate:self didEndSelector:@selector(...) contextInfo:nil];
|
|
|
|
switch(state.buttons) {
|
|
case MessageWindow::Buttons::Ok:
|
|
if(response == NSAlertFirstButtonReturn) return MessageWindow::Response::Ok;
|
|
break;
|
|
case MessageWindow::Buttons::OkCancel:
|
|
if(response == NSAlertFirstButtonReturn) return MessageWindow::Response::Ok;
|
|
if(response == NSAlertSecondButtonReturn) return MessageWindow::Response::Cancel;
|
|
break;
|
|
case MessageWindow::Buttons::YesNo:
|
|
if(response == NSAlertFirstButtonReturn) return MessageWindow::Response::Yes;
|
|
if(response == NSAlertSecondButtonReturn) return MessageWindow::Response::No;
|
|
break;
|
|
case MessageWindow::Buttons::YesNoCancel:
|
|
if(response == NSAlertFirstButtonReturn) return MessageWindow::Response::Yes;
|
|
if(response == NSAlertSecondButtonReturn) return MessageWindow::Response::No;
|
|
if(response == NSAlertThirdButtonReturn) return MessageWindow::Response::Cancel;
|
|
break;
|
|
}
|
|
}
|
|
|
|
throw;
|
|
}
|
|
|
|
auto pMessageWindow::error(MessageWindow::State& state) -> MessageWindow::Response {
|
|
return MessageWindow_dialog(state, MessageWindowType::Error);
|
|
}
|
|
|
|
auto pMessageWindow::information(MessageWindow::State& state) -> MessageWindow::Response {
|
|
return MessageWindow_dialog(state, MessageWindowType::Information);
|
|
}
|
|
|
|
auto pMessageWindow::question(MessageWindow::State& state) -> MessageWindow::Response {
|
|
return MessageWindow_dialog(state, MessageWindowType::Question);
|
|
}
|
|
|
|
auto pMessageWindow::warning(MessageWindow::State& state) -> MessageWindow::Response {
|
|
return MessageWindow_dialog(state, MessageWindowType::Warning);
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|