1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDialog class
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_UNIV_DIALOG_H_
12 #define _WX_UNIV_DIALOG_H_
15 #pragma interface "univdialog.h"
18 WXDLLEXPORT_DATA(extern const wxChar
*) wxDialogNameStr
;
19 class WXDLLEXPORT wxWindowDisabler
;
20 class WXDLLEXPORT wxEventLoop
;
23 class WXDLLEXPORT wxDialog
: public wxDialogBase
26 wxDialog() { Init(); }
28 // Constructor with a modal flag, but no window id - the old convention
29 wxDialog(wxWindow
*parent
,
30 const wxString
& title
, bool modal
,
31 int x
= -1, int y
= -1, int width
= 500, int height
= 500,
32 long style
= wxDEFAULT_DIALOG_STYLE
,
33 const wxString
& name
= wxDialogNameStr
)
35 long modalStyle
= modal
? wxDIALOG_MODAL
: wxDIALOG_MODELESS
;
37 Create(parent
, -1, title
, wxPoint(x
, y
), wxSize(width
, height
),
38 style
| modalStyle
, name
);
43 // Constructor with no modal flag - the new convention.
44 wxDialog(wxWindow
*parent
, wxWindowID id
,
45 const wxString
& title
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
48 long style
= wxDEFAULT_DIALOG_STYLE
,
49 const wxString
& name
= wxDialogNameStr
)
52 Create(parent
, id
, title
, pos
, size
, style
, name
);
55 bool Create(wxWindow
*parent
, wxWindowID id
,
56 const wxString
& title
,
57 const wxPoint
& pos
= wxDefaultPosition
,
58 const wxSize
& size
= wxDefaultSize
,
59 long style
= wxDEFAULT_DIALOG_STYLE
,
60 const wxString
& name
= wxDialogNameStr
);
62 void SetModal(bool flag
);
63 virtual bool IsModal() const;
65 // For now, same as Show(TRUE) but returns return code
66 virtual int ShowModal();
68 // may be called to terminate the dialog with the given return code
69 virtual void EndModal(int retCode
);
71 // returns TRUE if we're in a modal loop
72 bool IsModalShowing() const;
76 // implementation only from now on
77 // -------------------------------
80 void OnCloseWindow(wxCloseEvent
& event
);
81 void OnOK(wxCommandEvent
& event
);
82 void OnApply(wxCommandEvent
& event
);
83 void OnCancel(wxCommandEvent
& event
);
86 // common part of all ctors
90 // while we are showing a modal dialog we disable the other windows using
92 wxWindowDisabler
*m_windowDisabler
;
93 // modal dialog runs its own event loop
94 wxEventLoop
*m_eventLoop
;
95 // is modal right now?
96 bool m_isShowingModal
;
98 DECLARE_DYNAMIC_CLASS(wxDialog
)
103 // _WX_UNIV_DIALOG_H_