mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 06:32:32 +01:00
byuu says: Finally!! Compilation works once again on Windows. However, it's pretty buggy. Modality isn't really working right, you can still poke at other windows, but when you select ListView items, they redraw as empty boxes (need to process WM_DRAWITEM before checking modality.) The program crashes when you close it (probably a ruby driver's term() function, that's what it usually is.) The Layout::setEnabled(false) call isn't working right, so you get that annoying chiming sound and cursor movement when mapping keyboard keys to game inputs. The column sizing seems off a bit on first display for the Hotkeys tab. And probably lots more.
59 lines
2.5 KiB
C++
59 lines
2.5 KiB
C++
#if defined(Hiro_MessageWindow)
|
|
|
|
namespace hiro {
|
|
|
|
static auto MessageWindow_response(MessageWindow::Buttons buttons, UINT response) -> MessageWindow::Response {
|
|
if(response == IDOK) return MessageWindow::Response::Ok;
|
|
if(response == IDCANCEL) return MessageWindow::Response::Cancel;
|
|
if(response == IDYES) return MessageWindow::Response::Yes;
|
|
if(response == IDNO) return MessageWindow::Response::No;
|
|
|
|
//default responses if window was closed without a button selected
|
|
if(buttons == MessageWindow::Buttons::Ok) return MessageWindow::Response::Ok;
|
|
if(buttons == MessageWindow::Buttons::OkCancel) return MessageWindow::Response::Cancel;
|
|
if(buttons == MessageWindow::Buttons::YesNo) return MessageWindow::Response::No;
|
|
if(buttons == MessageWindow::Buttons::YesNoCancel) return MessageWindow::Response::Cancel;
|
|
|
|
throw;
|
|
}
|
|
|
|
static auto MessageWindow_buttons(MessageWindow::Buttons buttons) -> UINT {
|
|
if(buttons == MessageWindow::Buttons::Ok) return MB_OK;
|
|
if(buttons == MessageWindow::Buttons::OkCancel) return MB_OKCANCEL;
|
|
if(buttons == MessageWindow::Buttons::YesNo) return MB_YESNO;
|
|
if(buttons == MessageWindow::Buttons::YesNoCancel) return MB_YESNOCANCEL;
|
|
throw;
|
|
}
|
|
|
|
auto pMessageWindow::error(MessageWindow::State& state) -> MessageWindow::Response {
|
|
UINT flags = MB_ICONERROR | MessageWindow_buttons(state.buttons);
|
|
return MessageWindow_response(state.buttons, MessageBox(
|
|
state.parent ? state.parent->self()->hwnd : 0, utf16_t(state.text), utf16_t(state.title), flags
|
|
));
|
|
}
|
|
|
|
auto pMessageWindow::information(MessageWindow::State& state) -> MessageWindow::Response {
|
|
UINT flags = MB_ICONINFORMATION | MessageWindow_buttons(state.buttons);
|
|
return MessageWindow_response(state.buttons, MessageBox(
|
|
state.parent ? state.parent->self()->hwnd : 0, utf16_t(state.text), utf16_t(state.title), flags
|
|
));
|
|
}
|
|
|
|
auto pMessageWindow::question(MessageWindow::State& state) -> MessageWindow::Response {
|
|
UINT flags = MB_ICONQUESTION | MessageWindow_buttons(state.buttons);
|
|
return MessageWindow_response(state.buttons, MessageBox(
|
|
state.parent ? state.parent->self()->hwnd : 0, utf16_t(state.text), utf16_t(state.title), flags
|
|
));
|
|
}
|
|
|
|
auto pMessageWindow::warning(MessageWindow::State& state) -> MessageWindow::Response {
|
|
UINT flags = MB_ICONWARNING | MessageWindow_buttons(state.buttons);
|
|
return MessageWindow_response(state.buttons, MessageBox(
|
|
state.parent ? state.parent->self()->hwnd : 0, utf16_t(state.text), utf16_t(state.title), flags
|
|
));
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|