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