- msStyle = MB_OK;
- }
- if (m_dialogStyle & wxICON_EXCLAMATION)
- msStyle |= MB_ICONEXCLAMATION;
- else if (m_dialogStyle & wxICON_HAND)
- msStyle |= MB_ICONHAND;
- else if (m_dialogStyle & wxICON_INFORMATION)
- msStyle |= MB_ICONINFORMATION;
- else if (m_dialogStyle & wxICON_QUESTION)
- msStyle |= MB_ICONQUESTION;
-
- if (hWnd)
- msStyle |= MB_APPLMODAL;
- else
- msStyle |= MB_TASKMODAL;
-
- int msAns = MessageBox(hWnd, (LPCTSTR)(const wxChar *)m_message, (LPCTSTR)(const wxChar *)m_caption, msStyle);
- int ans = wxOK;
- switch (msAns)
- {
- case IDCANCEL:
- ans = wxID_CANCEL;
- break;
- case IDOK:
- ans = wxID_OK;
- break;
- case IDYES:
- ans = wxID_YES;
- break;
- case IDNO:
- ans = wxID_NO;
- break;
- }
- return ans;
+ msStyle |= MB_TASKMODAL;
+
+ // per MSDN documentation for MessageBox() we can prefix the message with 2
+ // right-to-left mark characters to tell the function to use RTL layout
+ // (unfortunately this only works in Unicode builds)
+ wxString message = GetFullMessage();
+#if wxUSE_UNICODE
+ if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft )
+ {
+ // NB: not all compilers support \u escapes
+ static const wchar_t wchRLM = 0x200f;
+ message.Prepend(wxString(wchRLM, 2));
+ }
+#endif // wxUSE_UNICODE
+
+ // do show the dialog
+ int msAns = MessageBox(hWnd, message.wx_str(), m_caption.wx_str(), msStyle);
+ int ans;
+ switch (msAns)
+ {
+ default:
+ wxFAIL_MSG(_T("unexpected ::MessageBox() return code"));
+ // fall through
+
+ case IDCANCEL:
+ ans = wxID_CANCEL;
+ break;
+ case IDOK:
+ ans = wxID_OK;
+ break;
+ case IDYES:
+ ans = wxID_YES;
+ break;
+ case IDNO:
+ ans = wxID_NO;
+ break;
+ }
+ return ans;