2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
2011-02-24 09:25:20 +00:00
|
|
|
static MessageWindow::Response MessageWindow_response(MessageWindow::Buttons buttons, UINT 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;
|
|
|
|
if(buttons == MessageWindow::Buttons::OkCancel) return MessageWindow::Response::Cancel;
|
|
|
|
if(buttons == MessageWindow::Buttons::YesNo) return MessageWindow::Response::No;
|
|
|
|
return MessageWindow::Response::Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageWindow::Response pMessageWindow::information(Window &parent, const string &text, MessageWindow::Buttons buttons) {
|
|
|
|
UINT flags = MB_ICONINFORMATION;
|
|
|
|
if(buttons == MessageWindow::Buttons::Ok) flags |= MB_OK;
|
|
|
|
if(buttons == MessageWindow::Buttons::OkCancel) flags |= MB_OKCANCEL;
|
|
|
|
if(buttons == MessageWindow::Buttons::YesNo) flags |= MB_YESNO;
|
2012-08-07 13:28:00 +00:00
|
|
|
return MessageWindow_response(buttons, MessageBox(&parent != &Window::none() ? parent.p.hwnd : 0, utf16_t(text), L"", flags));
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MessageWindow::Response pMessageWindow::question(Window &parent, const string &text, MessageWindow::Buttons buttons) {
|
|
|
|
UINT flags = MB_ICONQUESTION;
|
|
|
|
if(buttons == MessageWindow::Buttons::Ok) flags |= MB_OK;
|
|
|
|
if(buttons == MessageWindow::Buttons::OkCancel) flags |= MB_OKCANCEL;
|
|
|
|
if(buttons == MessageWindow::Buttons::YesNo) flags |= MB_YESNO;
|
2012-08-07 13:28:00 +00:00
|
|
|
return MessageWindow_response(buttons, MessageBox(&parent != &Window::none() ? parent.p.hwnd : 0, utf16_t(text), L"", flags));
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MessageWindow::Response pMessageWindow::warning(Window &parent, const string &text, MessageWindow::Buttons buttons) {
|
|
|
|
UINT flags = MB_ICONWARNING;
|
|
|
|
if(buttons == MessageWindow::Buttons::Ok) flags |= MB_OK;
|
|
|
|
if(buttons == MessageWindow::Buttons::OkCancel) flags |= MB_OKCANCEL;
|
|
|
|
if(buttons == MessageWindow::Buttons::YesNo) flags |= MB_YESNO;
|
2012-08-07 13:28:00 +00:00
|
|
|
return MessageWindow_response(buttons, MessageBox(&parent != &Window::none() ? parent.p.hwnd : 0, utf16_t(text), L"", flags));
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MessageWindow::Response pMessageWindow::critical(Window &parent, const string &text, MessageWindow::Buttons buttons) {
|
|
|
|
UINT flags = MB_ICONERROR;
|
|
|
|
if(buttons == MessageWindow::Buttons::Ok) flags |= MB_OK;
|
|
|
|
if(buttons == MessageWindow::Buttons::OkCancel) flags |= MB_OKCANCEL;
|
|
|
|
if(buttons == MessageWindow::Buttons::YesNo) flags |= MB_YESNO;
|
2012-08-07 13:28:00 +00:00
|
|
|
return MessageWindow_response(buttons, MessageBox(&parent != &Window::none() ? parent.p.hwnd : 0, utf16_t(text), L"", flags));
|
2011-02-24 09:25:20 +00:00
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
}
|