MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / OSDisplayError

Function OSDisplayError

Source/Compat/Win/os_dialogs_win.cpp:37–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35#include <string>
36
37ErrorResponse OSDisplayError(const char* title, const char* contents, ErrorType type) {
38 bool old_mouse = Input::Instance()->GetGrabMouse();
39 Input::Instance()->SetGrabMouse(false);
40 UIShowCursor(1);
41
42 int msgboxID;
43 switch (type) {
44 case _ok_cancel_retry:
45 msgboxID = MessageBox(NULL,
46 contents,
47 title,
48 MB_CANCELTRYCONTINUE |
49 MB_DEFBUTTON2 |
50 MB_ICONHAND |
51 MB_TOPMOST |
52 MB_SETFOREGROUND);
53 break;
54 case _ok_cancel:
55 msgboxID = MessageBox(NULL,
56 contents,
57 title,
58 MB_OKCANCEL |
59 MB_DEFBUTTON1 |
60 MB_ICONHAND |
61 MB_TOPMOST |
62 MB_SETFOREGROUND);
63 break;
64 case _ok:
65 msgboxID = MessageBox(NULL,
66 contents,
67 title,
68 MB_DEFBUTTON1 |
69 MB_ICONHAND |
70 MB_TOPMOST |
71 MB_SETFOREGROUND);
72 break;
73 }
74 switch (msgboxID) {
75 case IDCANCEL:
76 return _er_exit;
77 break;
78 case IDTRYAGAIN:
79 case IDRETRY:
80 Input::Instance()->SetGrabMouse(old_mouse);
81 UIShowCursor(0);
82 return _retry;
83 break;
84 case IDCONTINUE:
85 case IDOK:
86 Input::Instance()->SetGrabMouse(old_mouse);
87 UIShowCursor(0);
88 return _continue;
89 break;
90 }
91 return _continue;
92}

Callers 1

DisplayLastQueuedErrorFunction · 0.50

Calls 3

UIShowCursorFunction · 0.85
GetGrabMouseMethod · 0.80
SetGrabMouseMethod · 0.80

Tested by

no test coverage detected