13 using MsgBoxCallback = Action<>;
18 enum class MsgBoxButton {
19 AbortRetryIgnore = MB_ABORTRETRYIGNORE,
20 CancelRetryContinue = MB_CANCELTRYCONTINUE,
22 OkCancel = MB_OKCANCEL,
23 RetryCancel = MB_RETRYCANCEL,
25 YesNoCancel = MB_YESNOCANCEL,
31 enum class MsgBoxIcon {
33 Warning = MB_ICONWARNING,
34 Information = MB_ICONINFORMATION,
35 Question = MB_ICONQUESTION,
42 enum class MsgBoxResult {
45 Continue = IDCONTINUE,
50 TryAgain = IDTRYAGAIN,
71 operator sw::MsgBoxResult()
const;
122 template <MsgBoxResult RES>
125 if (this->result == RES) {
126 if (callback) callback();
144 static MsgBoxResultHelper Show(
const WndBase *owner,
const std::wstring &text = L
"",
const std::wstring &caption = L
"", MsgBoxButton button = MsgBoxButton::Ok, MsgBoxIcon icon = MsgBoxIcon::None);
149 static MsgBoxResultHelper Show(
const WndBase &owner,
const std::wstring &text = L
"",
const std::wstring &caption = L
"", MsgBoxButton button = MsgBoxButton::Ok, MsgBoxIcon icon = MsgBoxIcon::None);
154 static MsgBoxResultHelper Show(
const std::wstring &text = L
"",
const std::wstring &caption = L
"", MsgBoxButton button = MsgBoxButton::Ok, MsgBoxIcon icon = MsgBoxIcon::None);
169 static MsgBoxResultHelper ShowInfo(
const std::wstring &text = L
"",
const std::wstring &caption = L
"", MsgBoxButton button = MsgBoxButton::Ok);
消息框类
Definition MsgBox.h:136
static MsgBoxResultHelper ShowQuestion(const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::YesNo)
显示一个含“问题”图标的消息框,将当前活动窗体作为Owner
static MsgBoxResultHelper ShowWarning(const WndBase *owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“警告”图标的消息框
static MsgBoxResultHelper ShowWarning(const WndBase &owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“警告”图标的消息框
static MsgBoxResultHelper ShowInfo(const WndBase *owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“消息”图标的消息框
static MsgBoxResultHelper ShowInfo(const WndBase &owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“消息”图标的消息框
static MsgBoxResultHelper Show(const WndBase &owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok, MsgBoxIcon icon=MsgBoxIcon::None)
显示消息框
static MsgBoxResultHelper ShowQuestion(const WndBase *owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::YesNo)
显示一个含“问题”图标的消息框
static MsgBoxResultHelper ShowInfo(const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“消息”图标的消息框,将当前活动窗体作为Owner
static MsgBoxResultHelper ShowError(const WndBase *owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“错误”图标的消息框
static MsgBoxResultHelper ShowQuestion(const WndBase &owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::YesNo)
显示一个含“问题”图标的消息框
static MsgBoxResultHelper Show(const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok, MsgBoxIcon icon=MsgBoxIcon::None)
显示消息框,将当前活动窗体作为Owner
static MsgBoxResultHelper ShowWarning(const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“警告”图标的消息框,将当前活动窗体作为Owner
static MsgBoxResultHelper ShowError(const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“错误”图标的消息框,将当前活动窗体作为Owner
static MsgBoxResultHelper Show(const WndBase *owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok, MsgBoxIcon icon=MsgBoxIcon::None)
显示消息框
static MsgBoxResultHelper ShowError(const WndBase &owner, const std::wstring &text=L"", const std::wstring &caption=L"", MsgBoxButton button=MsgBoxButton::Ok)
显示一个含“错误”图标的消息框
表示一个Windows窗口,是所有窗口和控件的基类
Definition WndBase.h:41
处理消息框消息的帮助类
Definition MsgBox.h:57
MsgBoxResultHelper & OnNo(const MsgBoxCallback &callback)
指定按下“否”按钮时的处理函数
MsgBoxResultHelper & OnTryAgain(const MsgBoxCallback &callback)
指定按下“重试”按钮时的处理函数
MsgBoxResultHelper & OnContinue(const MsgBoxCallback &callback)
指定按下“继续”按钮时的处理函数
MsgBoxResultHelper & OnYes(const MsgBoxCallback &callback)
指定按下“是”按钮时的处理函数
MsgBoxResultHelper & OnAbort(const MsgBoxCallback &callback)
指定按下“中止”按钮时的处理函数
MsgBoxResult result
消息框的结果
Definition MsgBox.h:61
MsgBoxResultHelper & OnRetry(const MsgBoxCallback &callback)
指定按下“重试”按钮时的处理函数
MsgBoxResultHelper & OnCancel(const MsgBoxCallback &callback)
指定按下“取消”按钮时的处理函数
MsgBoxResultHelper & OnIgnore(const MsgBoxCallback &callback)
指定按下“忽略”按钮时的处理函数
MsgBoxResultHelper & OnOk(const MsgBoxCallback &callback)
指定按下“确定”按钮时的处理函数
MsgBoxResultHelper & On(const MsgBoxCallback &callback)
指定消息框结果的处理函数
Definition MsgBox.h:123
MsgBoxResultHelper(MsgBoxResult result)
构造MsgBoxResultHelper