]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/dialog.mm
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / osx / cocoa / dialog.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/dialog.mm
3 // Purpose: wxDialog class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #include "wx/dialog.h"
14
15 #ifndef WX_PRECOMP
16 #include "wx/app.h"
17 #include "wx/utils.h"
18 #include "wx/frame.h"
19 #include "wx/settings.h"
20 #endif // WX_PRECOMP
21
22 #include "wx/osx/private.h"
23
24 extern wxList wxModalDialogs;
25
26 void wxDialog::DoShowWindowModal()
27 {
28 wxTopLevelWindow* parent = static_cast<wxTopLevelWindow*>(wxGetTopLevelParent(GetParent()));
29
30 wxASSERT_MSG(parent, "ShowWindowModal requires the dialog to have a parent.");
31
32 NSWindow* parentWindow = parent->GetWXWindow();
33 NSWindow* theWindow = GetWXWindow();
34
35 [NSApp beginSheet: theWindow
36 modalForWindow: parentWindow
37 modalDelegate: theWindow
38 didEndSelector: nil
39 contextInfo: nil];
40 }
41
42 void wxDialog::EndWindowModal()
43 {
44 [NSApp endSheet: GetWXWindow()];
45 [GetWXWindow() orderOut:GetWXWindow()];
46 }