1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/dialog.cpp
3 // Purpose: wxDialog class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/dialog.h"
20 #include "wx/settings.h"
23 #include "wx/osx/private.h"
24 #include "wx/evtloop.h"
26 extern wxList wxModalDialogs
;
28 void wxDialog::DoShowModal()
30 wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
32 wxModalDialogs
.Append(this);
36 WindowRef windowRef
= (WindowRef
) GetWXWindow();
37 WindowGroupRef windowGroup
= NULL
;
38 WindowGroupRef formerParentGroup
= NULL
;
39 bool resetGroupParent
= false;
41 if ( GetParent() == NULL
)
43 windowGroup
= GetWindowGroup(windowRef
) ;
44 if ( windowGroup
!= GetWindowGroupOfClass( kMovableModalWindowClass
) )
46 formerParentGroup
= GetWindowGroupParent( windowGroup
);
47 SetWindowGroupParent( windowGroup
, GetWindowGroupOfClass( kMovableModalWindowClass
) );
48 resetGroupParent
= true;
51 BeginAppModalStateForWindow(windowRef
) ;
53 #if wxUSE_CONSOLE_EVENTLOOP
54 wxEventLoopGuarantor ensureHasLoop
;
56 wxEventLoopBase
* const loop
= wxEventLoop::GetActive();
60 EndAppModalStateForWindow(windowRef
) ;
61 if ( resetGroupParent
)
63 SetWindowGroupParent( windowGroup
, formerParentGroup
);