summaryrefslogtreecommitdiff
path: root/Source/Core/Common/MsgHandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/MsgHandler.h')
-rw-r--r--Source/Core/Common/MsgHandler.h85
1 files changed, 63 insertions, 22 deletions
diff --git a/Source/Core/Common/MsgHandler.h b/Source/Core/Common/MsgHandler.h
index dcb79f4196..b5f7efbe01 100644
--- a/Source/Core/Common/MsgHandler.h
+++ b/Source/Core/Common/MsgHandler.h
@@ -6,6 +6,8 @@
#include <string>
+namespace Common
+{
// Message alerts
enum class MsgType
{
@@ -15,8 +17,8 @@ enum class MsgType
Critical
};
-typedef bool (*MsgAlertHandler)(const char* caption, const char* text, bool yes_no, MsgType style);
-typedef std::string (*StringTranslator)(const char* text);
+using MsgAlertHandler = bool (*)(const char* caption, const char* text, bool yes_no, MsgType style);
+using StringTranslator = std::string (*)(const char* text);
void RegisterMsgAlertHandler(MsgAlertHandler handler);
void RegisterStringTranslator(StringTranslator translator);
@@ -28,30 +30,69 @@ bool MsgAlert(bool yes_no, MsgType style, const char* format, ...)
#endif
;
void SetEnableAlert(bool enable);
+} // namespace Common
#ifdef _WIN32
-#define SuccessAlert(format, ...) MsgAlert(false, MsgType::Information, format, __VA_ARGS__)
-#define PanicAlert(format, ...) MsgAlert(false, MsgType::Warning, format, __VA_ARGS__)
-#define PanicYesNo(format, ...) MsgAlert(true, MsgType::Warning, format, __VA_ARGS__)
-#define AskYesNo(format, ...) MsgAlert(true, MsgType::Question, format, __VA_ARGS__)
-#define CriticalAlert(format, ...) MsgAlert(false, MsgType::Critical, format, __VA_ARGS__)
+#define SuccessAlert(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Information, format, __VA_ARGS__)
+
+#define PanicAlert(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Warning, format, __VA_ARGS__)
+
+#define PanicYesNo(format, ...) \
+ Common::MsgAlert(true, Common::MsgType::Warning, format, __VA_ARGS__)
+
+#define AskYesNo(format, ...) Common::MsgAlert(true, Common::MsgType::Question, format, __VA_ARGS__)
+
+#define CriticalAlert(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Critical, format, __VA_ARGS__)
+
// Use these macros (that do the same thing) if the message should be translated.
-#define SuccessAlertT(format, ...) MsgAlert(false, MsgType::Information, format, __VA_ARGS__)
-#define PanicAlertT(format, ...) MsgAlert(false, MsgType::Warning, format, __VA_ARGS__)
-#define PanicYesNoT(format, ...) MsgAlert(true, MsgType::Warning, format, __VA_ARGS__)
-#define AskYesNoT(format, ...) MsgAlert(true, MsgType::Question, format, __VA_ARGS__)
-#define CriticalAlertT(format, ...) MsgAlert(false, MsgType::Critical, format, __VA_ARGS__)
+
+#define SuccessAlertT(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Information, format, __VA_ARGS__)
+
+#define PanicAlertT(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Warning, format, __VA_ARGS__)
+
+#define PanicYesNoT(format, ...) \
+ Common::MsgAlert(true, Common::MsgType::Warning, format, __VA_ARGS__)
+
+#define AskYesNoT(format, ...) \
+ Common::MsgAlert(true, Common::MsgType::Question, format, __VA_ARGS__)
+
+#define CriticalAlertT(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Critical, format, __VA_ARGS__)
#else
-#define SuccessAlert(format, ...) MsgAlert(false, MsgType::Information, format, ##__VA_ARGS__)
-#define PanicAlert(format, ...) MsgAlert(false, MsgType::Warning, format, ##__VA_ARGS__)
-#define PanicYesNo(format, ...) MsgAlert(true, MsgType::Warning, format, ##__VA_ARGS__)
-#define AskYesNo(format, ...) MsgAlert(true, MsgType::Question, format, ##__VA_ARGS__)
-#define CriticalAlert(format, ...) MsgAlert(false, MsgType::Critical, format, ##__VA_ARGS__)
+#define SuccessAlert(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Information, format, ##__VA_ARGS__)
+
+#define PanicAlert(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Warning, format, ##__VA_ARGS__)
+
+#define PanicYesNo(format, ...) \
+ Common::MsgAlert(true, Common::MsgType::Warning, format, ##__VA_ARGS__)
+
+#define AskYesNo(format, ...) \
+ Common::MsgAlert(true, Common::MsgType::Question, format, ##__VA_ARGS__)
+
+#define CriticalAlert(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Critical, format, ##__VA_ARGS__)
+
// Use these macros (that do the same thing) if the message should be translated.
-#define SuccessAlertT(format, ...) MsgAlert(false, MsgType::Information, format, ##__VA_ARGS__)
-#define PanicAlertT(format, ...) MsgAlert(false, MsgType::Warning, format, ##__VA_ARGS__)
-#define PanicYesNoT(format, ...) MsgAlert(true, MsgType::Warning, format, ##__VA_ARGS__)
-#define AskYesNoT(format, ...) MsgAlert(true, MsgType::Question, format, ##__VA_ARGS__)
-#define CriticalAlertT(format, ...) MsgAlert(false, MsgType::Critical, format, ##__VA_ARGS__)
+#define SuccessAlertT(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Information, format, ##__VA_ARGS__)
+
+#define PanicAlertT(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Warning, format, ##__VA_ARGS__)
+
+#define PanicYesNoT(format, ...) \
+ Common::MsgAlert(true, Common::MsgType::Warning, format, ##__VA_ARGS__)
+
+#define AskYesNoT(format, ...) \
+ Common::MsgAlert(true, Common::MsgType::Question, format, ##__VA_ARGS__)
+
+#define CriticalAlertT(format, ...) \
+ Common::MsgAlert(false, Common::MsgType::Critical, format, ##__VA_ARGS__)
#endif