]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/dialog.h
Common default notebook name.
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface "univdialog.h"
16 #endif
17
18 WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
19 class WXDLLEXPORT wxWindowDisabler;
20 class WXDLLEXPORT wxEventLoop;
21
22 // Dialog boxes
23 class WXDLLEXPORT wxDialog : public wxDialogBase
24 {
25 public:
26 wxDialog() { Init(); }
27
28 // Constructor with no modal flag - the new convention.
29 wxDialog(wxWindow *parent, wxWindowID id,
30 const wxString& title,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize,
33 long style = wxDEFAULT_DIALOG_STYLE,
34 const wxString& name = wxDialogNameStr)
35 {
36 Init();
37 Create(parent, id, title, pos, size, style, name);
38 }
39
40 bool Create(wxWindow *parent, wxWindowID id,
41 const wxString& title,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 long style = wxDEFAULT_DIALOG_STYLE,
45 const wxString& name = wxDialogNameStr);
46
47 virtual ~wxDialog();
48
49 // is the dialog in modal state right now?
50 virtual bool IsModal() const;
51
52 // For now, same as Show(true) but returns return code
53 virtual int ShowModal();
54
55 // may be called to terminate the dialog with the given return code
56 virtual void EndModal(int retCode);
57
58 // returns true if we're in a modal loop
59 bool IsModalShowing() const;
60
61 virtual bool Show(bool show = true);
62
63 // implementation only from now on
64 // -------------------------------
65
66 // event handlers
67 void OnCloseWindow(wxCloseEvent& event);
68 void OnOK(wxCommandEvent& event);
69 void OnApply(wxCommandEvent& event);
70 void OnCancel(wxCommandEvent& event);
71
72 protected:
73 // common part of all ctors
74 void Init();
75
76 private:
77 // while we are showing a modal dialog we disable the other windows using
78 // this object
79 wxWindowDisabler *m_windowDisabler;
80
81 // modal dialog runs its own event loop
82 wxEventLoop *m_eventLoop;
83
84 // is modal right now?
85 bool m_isShowingModal;
86
87 DECLARE_DYNAMIC_CLASS(wxDialog)
88 DECLARE_EVENT_TABLE()
89 };
90
91 #endif
92 // _WX_UNIV_DIALOG_H_