SimpleWindow
载入中...
搜索中...
未找到
MsgBox.h
1#pragma once
2
3#include "Delegate.h"
4#include "WndBase.h"
5#include <string>
6#include <windows.h>
7
8namespace sw
9{
22
33
37 enum class MsgBoxResult {
38 Abort = IDABORT,
42 No = IDNO,
43 Ok = IDOK,
44 Retry = IDRETRY,
46 Yes = IDYES,
47 };
48
135
139 class MsgBox
140 {
141 public:
145 MsgBox() = delete;
146
147 public:
151 static MsgBoxResultHelper Show(const WndBase *owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok, MsgBoxIcon icon = MsgBoxIcon::None);
152
156 static MsgBoxResultHelper Show(const WndBase &owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok, MsgBoxIcon icon = MsgBoxIcon::None);
157
161 static MsgBoxResultHelper Show(const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok, MsgBoxIcon icon = MsgBoxIcon::None);
162
166 static MsgBoxResultHelper ShowInfo(const WndBase *owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
167
171 static MsgBoxResultHelper ShowInfo(const WndBase &owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
172
176 static MsgBoxResultHelper ShowInfo(const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
177
181 static MsgBoxResultHelper ShowError(const WndBase *owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
182
186 static MsgBoxResultHelper ShowError(const WndBase &owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
187
191 static MsgBoxResultHelper ShowError(const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
192
196 static MsgBoxResultHelper ShowWarning(const WndBase *owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
197
201 static MsgBoxResultHelper ShowWarning(const WndBase &owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
202
206 static MsgBoxResultHelper ShowWarning(const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::Ok);
207
211 static MsgBoxResultHelper ShowQuestion(const WndBase *owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::YesNo);
212
216 static MsgBoxResultHelper ShowQuestion(const WndBase &owner, const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::YesNo);
217
221 static MsgBoxResultHelper ShowQuestion(const std::wstring &text = L"", const std::wstring &caption = L"", MsgBoxButton button = MsgBoxButton::YesNo);
222 };
223}
值转换器接口
Definition IValueConverter.h:14
处理消息框消息的辅助类
Definition MsgBox.h:53
MsgBoxResultHelper & OnAbort(const Action<> &callback)
指定按下“中止”按钮时的处理函数
MsgBoxResultHelper & OnContinue(const Action<> &callback)
指定按下“继续”按钮时的处理函数
MsgBoxResultHelper & OnTryAgain(const Action<> &callback)
指定按下“重试”按钮时的处理函数
MsgBoxResultHelper & OnCancel(const Action<> &callback)
指定按下“取消”按钮时的处理函数
MsgBoxResultHelper & OnOk(const Action<> &callback)
指定按下“确定”按钮时的处理函数
MsgBoxResultHelper & OnRetry(const Action<> &callback)
指定按下“重试”按钮时的处理函数
MsgBoxResultHelper & OnYes(const Action<> &callback)
指定按下“是”按钮时的处理函数
MsgBoxResultHelper & On(const Action<> &callback)
指定消息框结果的处理函数
Definition MsgBox.h:128
MsgBoxResultHelper & OnIgnore(const Action<> &callback)
指定按下“忽略”按钮时的处理函数
MsgBoxResultHelper & OnNo(const Action<> &callback)
指定按下“否”按钮时的处理函数
MsgBoxResultHelper(MsgBoxResult result)
构造MsgBoxResultHelper
ReadOnlyProperty< MsgBoxResult > Result
消息框的结果
Definition MsgBox.h:64
消息框类
Definition MsgBox.h:140
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)
显示消息框
MsgBox()=delete
静态类,不允许实例化
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:29
SimpleWindow框架的顶级命名空间,所有公共类型、控件、枚举和工具函数均定义于此。
Definition Alignment.h:4
MsgBoxButton
消息框按钮类型
Definition MsgBox.h:13
@ AbortRetryIgnore
“中止”、“重试”、“忽略” 三按钮
@ CancelRetryContinue
“取消”、“重试”、“继续” 三按钮
@ OkCancel
“确定”、“取消” 双按钮
@ RetryCancel
“重试”、“取消” 双按钮
@ YesNoCancel
“是”、“否”、“取消” 三按钮
@ Ok
“确定” 单按钮(默认)
@ YesNo
“是”、“否” 双按钮
MsgBoxResult
消息框结果
Definition MsgBox.h:37
@ Retry
用户点击了 “重试” 按钮
@ Abort
用户点击了 “中止” 按钮
@ Yes
用户点击了 “是” 按钮
@ Continue
用户点击了 “继续” 按钮
@ TryAgain
用户点击了 “重试” 按钮(仅 CancelRetryContinue 组合下产生)
@ Ignore
用户点击了 “忽略” 按钮
@ Cancel
Control-break processing
@ Warning
Warning icon
@ Error
Error icon
@ Information
Information icon
@ Question
Question mark icon
@ No
Unavailable
MsgBoxIcon
消息框图标类型
Definition MsgBox.h:26
@ None
不显示图标
@ None
Unmodified keys