]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/dialog.h
Fix bug with using uninitialized flags in GetParentForModalDialog().
[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 // implementation
66 // --------------
67
68 wxDialogModality GetModality() const;
69
70 #if wxOSX_USE_COCOA
71 virtual void ModalFinishedCallback(void* WXUNUSED(panel), int WXUNUSED(returnCode)) {}
72 #endif
73
74 protected:
75 // show window modal dialog
76 void DoShowWindowModal();
77
78 // end window modal dialog.
79 void EndWindowModal();
80
81 // mac also takes command-period as cancel
82 virtual bool IsEscapeKey(const wxKeyEvent& event);
83
84
85 wxDialogModality m_modality;
86
87 wxModalEventLoop* m_eventLoop;
88
89 private:
90 void Init();
91 };
92
93 #endif
94 // _WX_DIALOG_H_