X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FMoof%2FModalDialog.hh;h=f630cb6a21c64c5cab567a46e8880a10f376813a;hb=b357615aba1dbde81e3c6999366604e6001010a7;hp=11d9d7997916926b4fff50c25e44211af078f36d;hpb=8a1acac01b444dccf8b57cedf08392ada2e473c1;p=chaz%2Fyoink diff --git a/src/Moof/ModalDialog.hh b/src/Moof/ModalDialog.hh index 11d9d79..f630cb6 100644 --- a/src/Moof/ModalDialog.hh +++ b/src/Moof/ModalDialog.hh @@ -31,6 +31,10 @@ #include +#if HAVE_CONFIG_H +#include "../config.h" +#endif + #if defined(_WIN32) || defined(__WIN32__) #include #elif defined(__APPLE__) && defined(__MACH__) @@ -43,12 +47,9 @@ #include #endif +#include #include -#if HAVE_CONFIG_H -#include "config.h" -#endif - namespace Mf { @@ -66,14 +67,51 @@ struct ModalDialog CRITICAL = 3 }; + std::string title; Type type; std::string text1; std::string text2; + void run() const { -#if USE_GTK + switch (type) + { + case WARNING: + logWarning(text1); + logWarning(text2); + break; + case CRITICAL: + logError(text1); + logError(text2); + break; + default: + logInfo(text1); + logInfo(text2); + break; + } + +#if defined(_WIN32) || defined(__WIN32__) + + int iconType; + switch (type) + { + case WARNING: + iconType = MB_ICONWARNING; + break; + case CRITICAL: + iconType = MB_ICONERROR; + break; + default: + iconType = MB_ICONINFORMATION; + break; + } + + MessageBox(0, (text1 + "\n" + text2).c_str(), title.c_str(), + MB_OK | iconType); + +#elif USE_GTK int argc = 0; char** argv; @@ -107,7 +145,7 @@ struct ModalDialog gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); // FIXME - this doesn't seem to actually remove the window from the - // screen when it closes, not sure why... + // screen when it closes #elif USE_QT4