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; return MessageWindow_response(buttons, MessageBox(&parent != &Window::None ? parent.p.hwnd : 0, utf16_t(text), L"", flags)); }
MessageWindow::Response pMessageWindow::critical(Window &parent, const string &text, MessageWindow::Buttons buttons) { GtkButtonsType buttonsType = GTK_BUTTONS_OK; if(buttons == MessageWindow::Buttons::OkCancel) buttonsType = GTK_BUTTONS_OK_CANCEL; if(buttons == MessageWindow::Buttons::YesNo) buttonsType = GTK_BUTTONS_YES_NO; GtkWidget *dialog = gtk_message_dialog_new( &parent != &Window::none() ? GTK_WINDOW(parent.p.widget) : (GtkWindow*)nullptr, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, buttonsType, "%s", (const char*)text ); gint response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return MessageWindow_response(buttons, response); }
MessageWindow::Response pMessageWindow::warning(MessageWindow::State& state) { UINT flags = MB_ICONWARNING | MessageWindow_buttons(state.buttons); return MessageWindow_response(state.buttons, MessageBox( state.parent ? state.parent->p.hwnd : 0, utf16_t(state.text), utf16_t(state.title), flags )); }
MessageWindow::Response pMessageWindow::question(MessageWindow::State& state) { UINT flags = MB_ICONQUESTION | MessageWindow_buttons(state.buttons); return MessageWindow_response(state.buttons, MessageBox( state.parent ? state.parent->p.hwnd : 0, utf16_t(state.text), utf16_t(state.title), flags )); }
MessageWindow::Response pMessageWindow::critical(Window &parent, const string &text, MessageWindow::Buttons buttons) { return MessageWindow_response( buttons, QMessageBox::critical(&parent != &Window::None ? parent.p.qtWindow : 0, " ", QString::fromUtf8(text), MessageWindow_buttons(buttons)) ); }