]>
Commit | Line | Data |
---|---|---|
489468fe | 1 | ///////////////////////////////////////////////////////////////////////////// |
524c47aa | 2 | // Name: src/osx/carbon/dialog.cpp |
489468fe SC |
3 | // Purpose: wxDialog class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #include "wx/dialog.h" | |
15 | ||
16 | #ifndef WX_PRECOMP | |
17 | #include "wx/app.h" | |
18 | #include "wx/utils.h" | |
19 | #include "wx/frame.h" | |
20 | #include "wx/settings.h" | |
21 | #endif // WX_PRECOMP | |
22 | ||
524c47aa SC |
23 | #include "wx/osx/private.h" |
24 | #include "wx/evtloop.h" | |
489468fe | 25 | |
9482c644 KO |
26 | void wxDialog::EndWindowModal() |
27 | { | |
28 | // Nothing to do for now. | |
29 | } | |
30 | ||
4d572a2c | 31 | void wxDialog::DoShowWindowModal() |
9482c644 KO |
32 | { |
33 | // If someone wants to add support for this to wxOSX Carbon, here would | |
34 | // be the place to start: http://trac.wxwidgets.org/ticket/9459 | |
35 | // Unfortunately, supporting sheets in Carbon isn't as straightforward | |
36 | // as with Cocoa, so it will probably take some tweaking. | |
37 | wxDialogBase::ShowWindowModal(); | |
38 | } | |
39 | ||
489468fe SC |
40 | void wxDialog::DoShowModal() |
41 | { | |
489468fe SC |
42 | |
43 | SetFocus() ; | |
44 | ||
b2680ced | 45 | WindowRef windowRef = (WindowRef) GetWXWindow(); |
ca910e1a VZ |
46 | WindowGroupRef windowGroup = NULL; |
47 | WindowGroupRef formerParentGroup = NULL; | |
489468fe SC |
48 | bool resetGroupParent = false; |
49 | ||
50 | if ( GetParent() == NULL ) | |
51 | { | |
52 | windowGroup = GetWindowGroup(windowRef) ; | |
58d4ed8a JS |
53 | if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) ) |
54 | { | |
55 | formerParentGroup = GetWindowGroupParent( windowGroup ); | |
56 | SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) ); | |
57 | resetGroupParent = true; | |
58 | } | |
489468fe SC |
59 | } |
60 | BeginAppModalStateForWindow(windowRef) ; | |
61 | ||
d6d3b323 | 62 | #if wxUSE_CONSOLE_EVENTLOOP |
a2197925 | 63 | wxEventLoopGuarantor ensureHasLoop; |
d6d3b323 | 64 | #endif |
a2197925 VZ |
65 | wxEventLoopBase * const loop = wxEventLoop::GetActive(); |
66 | while ( IsModal() ) | |
67 | loop->Dispatch(); | |
489468fe SC |
68 | |
69 | EndAppModalStateForWindow(windowRef) ; | |
70 | if ( resetGroupParent ) | |
71 | { | |
72 | SetWindowGroupParent( windowGroup , formerParentGroup ); | |
73 | } | |
ca910e1a | 74 | } |