Fall back to default process layout direction in wxMSW.
Add helper wxApp::MSWGetDefaultLayout() static method and use it instead of wxTheApp->GetLayoutDirection() in wxMSW code. This serves two purposes: first, wxMessageDialog doesn't crash when it's shown before wxTheApp is created (or after it's destroyed) any more. And second, we use the correct layout direction if the main application has enabled it by calling SetProcessDefaultLayout() or using two U+200E characters in the beginning of its "FileDescription" resource field by default now. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -538,7 +538,7 @@ int wxMessageDialog::ShowMessageBox()
|
||||
msStyle |= MB_TOPMOST;
|
||||
|
||||
#ifndef __WXWINCE__
|
||||
if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft )
|
||||
if ( wxApp::MSWGetDefaultLayout(m_parent) == wxLayout_RightToLeft )
|
||||
msStyle |= MB_RTLREADING | MB_RIGHT;
|
||||
#endif
|
||||
|
||||
@@ -552,7 +552,7 @@ int wxMessageDialog::ShowMessageBox()
|
||||
// (unfortunately this only works in Unicode builds)
|
||||
wxString message = GetFullMessage();
|
||||
#if wxUSE_UNICODE
|
||||
if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft )
|
||||
if ( wxApp::MSWGetDefaultLayout(m_parent) == wxLayout_RightToLeft )
|
||||
{
|
||||
// NB: not all compilers support \u escapes
|
||||
static const wchar_t wchRLM = 0x200f;
|
||||
@@ -702,7 +702,7 @@ void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc)
|
||||
// use the top level window as parent if none specified
|
||||
tdc.hwndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
|
||||
if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft )
|
||||
if ( wxApp::MSWGetDefaultLayout(parent) == wxLayout_RightToLeft )
|
||||
tdc.dwFlags |= TDF_RTL_LAYOUT;
|
||||
|
||||
// If we have both the main and extended messages, just use them as
|
||||
|
Reference in New Issue
Block a user