]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/dialog.h
Add functor-taking overload of CallAfter().
[wxWidgets.git] / include / wx / osx / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/dialog.h
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 #ifndef _WX_DIALOG_H_
13 #define _WX_DIALOG_H_
14
15 #include "wx/panel.h"
16
17 class WXDLLIMPEXP_FWD_CORE wxMacToolTip ;
18 class WXDLLIMPEXP_FWD_CORE wxModalEventLoop ;
19
20 // Dialog boxes
21 class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase
22 {
23 DECLARE_DYNAMIC_CLASS(wxDialog)
24
25 public:
26 wxDialog() { Init(); }
27
28 // Constructor with no modal flag - the new convention.
29 wxDialog(wxWindow *parent, wxWindowID id,
30 const wxString& title,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize,
33 long style = wxDEFAULT_DIALOG_STYLE,
34 const wxString& name = wxDialogNameStr)
35 {
36 Init();
37 Create(parent, id, title, pos, size, style, name);
38 }
39
40 bool Create(wxWindow *parent, wxWindowID id,
41 const wxString& title,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 long style = wxDEFAULT_DIALOG_STYLE,
45 const wxString& name = wxDialogNameStr);
46
47 virtual ~wxDialog();
48
49 // virtual bool Destroy();
50 virtual bool Show(bool show = true);
51
52 // return true if we're showing the dialog modally
53 virtual bool IsModal() const;
54
55 // show the dialog modally and return the value passed to EndModal()
56 virtual int ShowModal();
57
58 virtual void ShowWindowModal();
59
60 // may be called to terminate the dialog with the given return code
61 virtual void EndModal(int retCode);
62
63 static bool OSXHasModalDialogsOpen();
64 static void OSXBeginModalDialog();
65 static void OSXEndModalDialog();
66
67 // implementation
68 // --------------
69
70 wxDialogModality GetModality() const;
71
72 #if wxOSX_USE_COCOA
73 virtual void ModalFinishedCallback(void* WXUNUSED(panel), int WXUNUSED(returnCode)) {}
74 #endif
75
76 protected:
77 // show window modal dialog
78 void DoShowWindowModal();
79
80 // end window modal dialog.
81 void EndWindowModal();
82
83 // mac also takes command-period as cancel
84 virtual bool IsEscapeKey(const wxKeyEvent& event);
85
86
87 wxDialogModality m_modality;
88
89 wxModalEventLoop* m_eventLoop;
90
91 private:
92 void Init();
93 };
94
95 #endif
96 // _WX_DIALOG_H_