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::EndWindowModal()
30 // Nothing to do for now.
33 void wxDialog::ShowWindowModal()
35 // If someone wants to add support for this to wxOSX Carbon, here would
36 // be the place to start: http://trac.wxwidgets.org/ticket/9459
37 // Unfortunately, supporting sheets in Carbon isn't as straightforward
38 // as with Cocoa, so it will probably take some tweaking.
39 wxDialogBase::ShowWindowModal();
42 void wxDialog::DoShowModal()
44 wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
46 wxModalDialogs
.Append(this);
50 WindowRef windowRef
= (WindowRef
) GetWXWindow();
51 WindowGroupRef windowGroup
= NULL
;
52 WindowGroupRef formerParentGroup
= NULL
;
53 bool resetGroupParent
= false;
55 if ( GetParent() == NULL
)
57 windowGroup
= GetWindowGroup(windowRef
) ;
58 if ( windowGroup
!= GetWindowGroupOfClass( kMovableModalWindowClass
) )
60 formerParentGroup
= GetWindowGroupParent( windowGroup
);
61 SetWindowGroupParent( windowGroup
, GetWindowGroupOfClass( kMovableModalWindowClass
) );
62 resetGroupParent
= true;
65 BeginAppModalStateForWindow(windowRef
) ;
67 #if wxUSE_CONSOLE_EVENTLOOP
68 wxEventLoopGuarantor ensureHasLoop
;
70 wxEventLoopBase
* const loop
= wxEventLoop::GetActive();
74 EndAppModalStateForWindow(windowRef
) ;
75 if ( resetGroupParent
)
77 SetWindowGroupParent( windowGroup
, formerParentGroup
);