forked from maximmenshikov/common
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXNAMessageBox.hpp
More file actions
66 lines (59 loc) · 1.6 KB
/
Copy pathXNAMessageBox.hpp
File metadata and controls
66 lines (59 loc) · 1.6 KB
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
#pragma once
#ifndef XNAMESSAGEBOX_HPP
#define XNAMESSAGEBOX_HPP
#include "XNAFrameworkCore.h"
typedef enum
{
XNA_RESULT_NONE = 0,
XNA_RESULT_LEFT = 1,
XNA_RESULT_RIGHT = 2
}XNA_RESULT;
namespace Xna
{
class Window
{
public:
static XNA_RESULT MessageBox(HWND hWnd, wchar_t *text, wchar_t *caption, int flags)
{
int icon = None;
wchar_t *btn1 = L"Ok";
wchar_t *btn2 = NULL;
if (flags & MB_OKCANCEL)
{
btn2 = L"Cancel";
}
else if (flags & MB_YESNO)
{
btn1 = L"Yes";
btn2 = L"No";
}
else if (flags & MB_RETRYCANCEL)
{
btn1 = L"Retry";
btn2 = L"Cancel";
}
if (flags & MB_ICONQUESTION)
icon = Alert;
else if (flags & MB_ICONEXCLAMATION)
icon = Warning;
GS_ActionDialogResult result;
XNA_RESULT funcResult = XNA_RESULT_NONE;
HANDLE mb = CreateMessageBoxDialog(caption, text, btn1, btn2, Alert);
GetDialogResult(mb, &result);
if (result.disReason == ButtonPressed)
{
if (result.iButtonPressed == 0)
{
funcResult = XNA_RESULT_LEFT;
}
else if (result.iButtonPressed == 1)
{
funcResult = XNA_RESULT_RIGHT;
}
}
ReleaseDialog(mb);
return funcResult;
}
};
}
#endif