Example #1
0
S32 Platform::messageBox(const UTF8 *title, const UTF8 *message, MBButtons buttons, MBIcons icon)
{

   // Get us rendering while we're blocking.
   winState.renderThreadBlocked = true;

#ifdef UNICODE
   const UTF16 *msg = convertUTF8toUTF16(message);
   const UTF16 *t = convertUTF8toUTF16(title);
#else
   const UTF8 *msg = message;
   const UTF8 *t = title;
#endif
   S32 ret = ::MessageBox(winState.appWindow, msg, t, getMaskFromID(sgButtonMap, buttons) | getMaskFromID(sgIconMap, icon));

#ifdef UNICODE
   delete [] msg;
   delete [] t;
#endif

   // Dialog is gone.
   winState.renderThreadBlocked = false;

   return getMaskFromID(sgMsgBoxRetMap, ret);
}
Example #2
0
S32 Platform::messageBox(const UTF8 *title, const UTF8 *message, MBButtons buttons, MBIcons icon)
{
   PlatformWindow *pWindow = WindowManager->getFirstWindow();

   // Get us rendering while we're blocking.
   winState.renderThreadBlocked = true;

   // We don't keep a locked mouse or else we're going 
   // to end up possibly locking our mouse out of the 
   // message box area
   bool cursorLocked = pWindow && pWindow->isMouseLocked();
   if( cursorLocked )
      pWindow->setMouseLocked( false );

   // Need a visible cursor to click stuff accurately
   bool cursorVisible = !pWindow || pWindow->isCursorVisible();
   if( !cursorVisible )
      pWindow->setCursorVisible(true);

#ifdef UNICODE
   const UTF16 *msg = createUTF16string(message);
   const UTF16 *t = createUTF16string(title);
#else
   const UTF8 *msg = message;
   const UTF8 *t = title;
#endif

   HWND parent = pWindow ? static_cast<Win32Window*>(pWindow)->getHWND() : NULL;
   S32 ret = ::MessageBox( parent, msg, t, getMaskFromID(sgButtonMap, buttons) | getMaskFromID(sgIconMap, icon));

#ifdef UNICODE
   delete [] msg;
   delete [] t;
#endif

   // Dialog is gone.
   winState.renderThreadBlocked = false;

   if( cursorVisible == false )
      pWindow->setCursorVisible( false );

   if( cursorLocked == true )
      pWindow->setMouseLocked( true );

   return getMaskFromID(sgMsgBoxRetMap, ret);
}