1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* Reporting.h
* -----------
* Purpose: A class for showing notifications, prompts, etc...
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
OPENMPT_NAMESPACE_BEGIN
enum ConfirmAnswer
{
cnfYes,
cnfNo,
cnfCancel,
};
enum RetryAnswer
{
rtyRetry,
rtyCancel,
};
class Reporting
{
public:
// TODO Quick'n'dirty workaround for MsgBox(). Shouldn't be public.
static UINT CustomNotification(const AnyStringLocale &text, const AnyStringLocale &caption, UINT flags, const CWnd *parent);
// Show a simple notification
static void Notification(const AnyStringLocale &text, const CWnd *parent = nullptr);
static void Notification(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
// Show a simple information
static void Information(const AnyStringLocale &text, const CWnd *parent = nullptr);
static void Information(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
// Show a simple warning
static void Warning(const AnyStringLocale &text, const CWnd *parent = nullptr);
static void Warning(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
// Show an error box.
static void Error(const AnyStringLocale &text, const CWnd *parent = nullptr);
static void Error(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
// Simplified version of the above
static void Message(LogLevel level, const AnyStringLocale &text, const CWnd *parent = nullptr);
static void Message(LogLevel level, const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
// Show a confirmation dialog.
static ConfirmAnswer Confirm(const AnyStringLocale &text, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr);
static ConfirmAnswer Confirm(const AnyStringLocale &text, const AnyStringLocale &caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr);
// work-around string literals for caption decaying to bool and catching the wrong overload instead of converting to a string.
static ConfirmAnswer Confirm(const AnyStringLocale &text, const char *caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr) { return Confirm(text, AnyStringLocale(caption), showCancel, defaultNo, parent); }
static ConfirmAnswer Confirm(const AnyStringLocale &text, const wchar_t *caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr) { return Confirm(text, AnyStringLocale(caption), showCancel, defaultNo, parent); }
static ConfirmAnswer Confirm(const AnyStringLocale &text, const CString &caption, bool showCancel = false, bool defaultNo = false, const CWnd *parent = nullptr) { return Confirm(text, AnyStringLocale(caption), showCancel, defaultNo, parent); }
// Show a confirmation dialog.
static RetryAnswer RetryCancel(const AnyStringLocale &text, const CWnd *parent = nullptr);
static RetryAnswer RetryCancel(const AnyStringLocale &text, const AnyStringLocale &caption, const CWnd *parent = nullptr);
};
OPENMPT_NAMESPACE_END
|