carbon modal state
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19013 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -124,8 +124,6 @@ bool wxDialog::IsModalShowing() const
|
|||||||
return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
|
return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool s_macIsInModalLoop ;
|
|
||||||
|
|
||||||
bool wxDialog::Show(bool show)
|
bool wxDialog::Show(bool show)
|
||||||
{
|
{
|
||||||
if ( !wxDialogBase::Show(show) )
|
if ( !wxDialogBase::Show(show) )
|
||||||
@@ -157,6 +155,10 @@ bool wxDialog::Show(bool show)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !TARGET_CARBON
|
||||||
|
extern bool s_macIsInModalLoop ;
|
||||||
|
#endif
|
||||||
|
|
||||||
void wxDialog::DoShowModal()
|
void wxDialog::DoShowModal()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") );
|
wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") );
|
||||||
@@ -175,22 +177,26 @@ void wxDialog::DoShowModal()
|
|||||||
{
|
{
|
||||||
winFocus = wxTheApp->GetTopWindow();
|
winFocus = wxTheApp->GetTopWindow();
|
||||||
}
|
}
|
||||||
|
#if TARGET_CARBON
|
||||||
|
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
|
||||||
|
#else
|
||||||
// TODO : test whether parent gets disabled
|
// TODO : test whether parent gets disabled
|
||||||
|
|
||||||
bool formerModal = s_macIsInModalLoop ;
|
bool formerModal = s_macIsInModalLoop ;
|
||||||
s_macIsInModalLoop = true ;
|
s_macIsInModalLoop = true ;
|
||||||
|
#endif
|
||||||
while ( IsModalShowing() )
|
while ( IsModalShowing() )
|
||||||
{
|
{
|
||||||
while ( !wxTheApp->Pending() && wxTheApp->ProcessIdle() )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
wxTheApp->MacDoOneEvent() ;
|
wxTheApp->MacDoOneEvent() ;
|
||||||
|
// calls process idle itself
|
||||||
}
|
}
|
||||||
|
|
||||||
s_macIsInModalLoop = formerModal ;
|
#if TARGET_CARBON
|
||||||
|
EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
|
||||||
|
#else
|
||||||
// TODO probably reenable the parent window if any
|
// TODO probably reenable the parent window if any
|
||||||
|
s_macIsInModalLoop = formerModal ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// and restore focus
|
// and restore focus
|
||||||
if ( winFocus )
|
if ( winFocus )
|
||||||
|
@@ -124,8 +124,6 @@ bool wxDialog::IsModalShowing() const
|
|||||||
return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
|
return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool s_macIsInModalLoop ;
|
|
||||||
|
|
||||||
bool wxDialog::Show(bool show)
|
bool wxDialog::Show(bool show)
|
||||||
{
|
{
|
||||||
if ( !wxDialogBase::Show(show) )
|
if ( !wxDialogBase::Show(show) )
|
||||||
@@ -157,6 +155,10 @@ bool wxDialog::Show(bool show)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !TARGET_CARBON
|
||||||
|
extern bool s_macIsInModalLoop ;
|
||||||
|
#endif
|
||||||
|
|
||||||
void wxDialog::DoShowModal()
|
void wxDialog::DoShowModal()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") );
|
wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") );
|
||||||
@@ -175,22 +177,26 @@ void wxDialog::DoShowModal()
|
|||||||
{
|
{
|
||||||
winFocus = wxTheApp->GetTopWindow();
|
winFocus = wxTheApp->GetTopWindow();
|
||||||
}
|
}
|
||||||
|
#if TARGET_CARBON
|
||||||
|
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
|
||||||
|
#else
|
||||||
// TODO : test whether parent gets disabled
|
// TODO : test whether parent gets disabled
|
||||||
|
|
||||||
bool formerModal = s_macIsInModalLoop ;
|
bool formerModal = s_macIsInModalLoop ;
|
||||||
s_macIsInModalLoop = true ;
|
s_macIsInModalLoop = true ;
|
||||||
|
#endif
|
||||||
while ( IsModalShowing() )
|
while ( IsModalShowing() )
|
||||||
{
|
{
|
||||||
while ( !wxTheApp->Pending() && wxTheApp->ProcessIdle() )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
wxTheApp->MacDoOneEvent() ;
|
wxTheApp->MacDoOneEvent() ;
|
||||||
|
// calls process idle itself
|
||||||
}
|
}
|
||||||
|
|
||||||
s_macIsInModalLoop = formerModal ;
|
#if TARGET_CARBON
|
||||||
|
EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
|
||||||
|
#else
|
||||||
// TODO probably reenable the parent window if any
|
// TODO probably reenable the parent window if any
|
||||||
|
s_macIsInModalLoop = formerModal ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// and restore focus
|
// and restore focus
|
||||||
if ( winFocus )
|
if ( winFocus )
|
||||||
|
Reference in New Issue
Block a user