]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/dialog.h
avoiding crashes on osx during app shutdown
[wxWidgets.git] / include / wx / univ / dialog.h
CommitLineData
0e0de6b8
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: dialog.h
3// Purpose: wxDialog class
4// Author: Vaclav Slavik
5// Created: 2001/09/16
6// RCS-ID: $Id$
7// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
65571936 8// Licence: wxWindows licence
0e0de6b8
VS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_UNIV_DIALOG_H_
12#define _WX_UNIV_DIALOG_H_
13
53a2db12 14extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[];
b5dbe15d
VS
15class WXDLLIMPEXP_FWD_CORE wxWindowDisabler;
16class WXDLLIMPEXP_FWD_CORE wxEventLoop;
0e0de6b8
VS
17
18// Dialog boxes
53a2db12 19class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase
0e0de6b8
VS
20{
21public:
6463b9f5 22 wxDialog() { Init(); }
0e0de6b8 23
0e0de6b8
VS
24 // Constructor with no modal flag - the new convention.
25 wxDialog(wxWindow *parent, wxWindowID id,
26 const wxString& title,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = wxDEFAULT_DIALOG_STYLE,
6463b9f5
JS
30 const wxString& name = wxDialogNameStr)
31 {
32 Init();
33 Create(parent, id, title, pos, size, style, name);
34 }
0e0de6b8
VS
35
36 bool Create(wxWindow *parent, wxWindowID id,
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = wxDEFAULT_DIALOG_STYLE,
41 const wxString& name = wxDialogNameStr);
42
a562f4fb
VZ
43 virtual ~wxDialog();
44
45 // is the dialog in modal state right now?
0e0de6b8
VS
46 virtual bool IsModal() const;
47
a290fa5a 48 // For now, same as Show(true) but returns return code
0e0de6b8
VS
49 virtual int ShowModal();
50
51 // may be called to terminate the dialog with the given return code
52 virtual void EndModal(int retCode);
53
a290fa5a 54 // returns true if we're in a modal loop
0e0de6b8
VS
55 bool IsModalShowing() const;
56
555f645a 57 virtual bool Show(bool show = true);
0e0de6b8
VS
58
59 // implementation only from now on
60 // -------------------------------
61
62 // event handlers
63 void OnCloseWindow(wxCloseEvent& event);
64 void OnOK(wxCommandEvent& event);
65 void OnApply(wxCommandEvent& event);
66 void OnCancel(wxCommandEvent& event);
67
68protected:
69 // common part of all ctors
70 void Init();
71
72private:
73 // while we are showing a modal dialog we disable the other windows using
74 // this object
75 wxWindowDisabler *m_windowDisabler;
a562f4fb 76
0e0de6b8
VS
77 // modal dialog runs its own event loop
78 wxEventLoop *m_eventLoop;
a562f4fb 79
0e0de6b8
VS
80 // is modal right now?
81 bool m_isShowingModal;
82
83 DECLARE_DYNAMIC_CLASS(wxDialog)
84 DECLARE_EVENT_TABLE()
85};
86
87#endif
88 // _WX_UNIV_DIALOG_H_