MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / messageBox

Method messageBox

Engine/source/platformWin32/nativeDialogs/win32MsgBox.cpp:84–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82//-----------------------------------------------------------------------------
83#ifndef TORQUE_SDL
84S32 Platform::messageBox(const UTF8 *title, const UTF8 *message, MBButtons buttons, MBIcons icon)
85{
86 PlatformWindow *pWindow = WindowManager->getFirstWindow();
87
88 // Get us rendering while we're blocking.
89 winState.renderThreadBlocked = true;
90
91 // We don't keep a locked mouse or else we're going
92 // to end up possibly locking our mouse out of the
93 // message box area
94 bool cursorLocked = pWindow && pWindow->isMouseLocked();
95 if( cursorLocked )
96 pWindow->setMouseLocked( false );
97
98 // Need a visible cursor to click stuff accurately
99 bool cursorVisible = !pWindow || pWindow->isCursorVisible();
100 if( !cursorVisible )
101 pWindow->setCursorVisible(true);
102
103#ifdef UNICODE
104 const UTF16 *msg = createUTF16string(message);
105 const UTF16 *t = createUTF16string(title);
106#else
107 const UTF8 *msg = message;
108 const UTF8 *t = title;
109#endif
110
111 HWND parent = pWindow ? static_cast<Win32Window*>(pWindow)->getHWND() : NULL;
112 S32 ret = ::MessageBox( parent, msg, t, getMaskFromID(sgButtonMap, buttons) | getMaskFromID(sgIconMap, icon));
113
114#ifdef UNICODE
115 delete [] msg;
116 delete [] t;
117#endif
118
119 // Dialog is gone.
120 winState.renderThreadBlocked = false;
121
122 if( cursorVisible == false )
123 pWindow->setCursorVisible( false );
124
125 if( cursorLocked == true )
126 pWindow->setMouseLocked( true );
127
128 return getMaskFromID(sgMsgBoxRetMap, ret);
129}
130#endif

Callers

nothing calls this directly

Calls 8

createUTF16stringFunction · 0.85
getMaskFromIDFunction · 0.85
MessageBoxFunction · 0.50
getFirstWindowMethod · 0.45
isMouseLockedMethod · 0.45
setMouseLockedMethod · 0.45
isCursorVisibleMethod · 0.45
setCursorVisibleMethod · 0.45

Tested by

no test coverage detected