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