simplifying modal event loop handling

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63828 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2010-04-02 14:52:08 +00:00
parent 175e9d71cd
commit 62068535c5
4 changed files with 19 additions and 113 deletions

View File

@@ -39,39 +39,3 @@ void wxDialog::DoShowWindowModal()
ShowModal();
SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED );
}
void wxDialog::DoShowModal()
{
SetFocus() ;
WindowRef windowRef = (WindowRef) GetWXWindow();
WindowGroupRef windowGroup = NULL;
WindowGroupRef formerParentGroup = NULL;
bool resetGroupParent = false;
if ( GetParent() == NULL )
{
windowGroup = GetWindowGroup(windowRef) ;
if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) )
{
formerParentGroup = GetWindowGroupParent( windowGroup );
SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
resetGroupParent = true;
}
}
BeginAppModalStateForWindow(windowRef) ;
#if wxUSE_CONSOLE_EVENTLOOP
wxEventLoopGuarantor ensureHasLoop;
#endif
wxEventLoopBase * const loop = wxEventLoop::GetActive();
while ( IsModal() )
loop->Dispatch();
EndAppModalStateForWindow(windowRef) ;
if ( resetGroupParent )
{
SetWindowGroupParent( windowGroup , formerParentGroup );
}
}