]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/dialog.h
Fix bug with using uninitialized flags in GetParentForModalDialog().
[wxWidgets.git] / include / wx / univ / dialog.h
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)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_UNIV_DIALOG_H_
12 #define _WX_UNIV_DIALOG_H_
13
14 extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[];
15 class WXDLLIMPEXP_FWD_CORE wxWindowDisabler;
16 class WXDLLIMPEXP_FWD_CORE wxEventLoop;
17
18 // Dialog boxes
19 class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase
20 {
21 public:
22 wxDialog() { Init(); }
23
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,
30 const wxString& name = wxDialogNameStr)
31 {
32 Init();
33 Create(parent, id, title, pos, size, style, name);
34 }
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
43 virtual ~wxDialog();
44
45 // is the dialog in modal state right now?
46 virtual bool IsModal() const;
47
48 // For now, same as Show(true) but returns return code
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
54 // returns true if we're in a modal loop
55 bool IsModalShowing() const;
56
57 virtual bool Show(bool show = true);
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
68 protected:
69 // common part of all ctors
70 void Init();
71
72 private:
73 // while we are showing a modal dialog we disable the other windows using
74 // this object
75 wxWindowDisabler *m_windowDisabler;
76
77 // modal dialog runs its own event loop
78 wxEventLoop *m_eventLoop;
79
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_