]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialog.h | |
3 | // Purpose: wxDialog class | |
fb46a9a6 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
fb46a9a6 | 6 | // Created: 10/14/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
fb46a9a6 | 8 | // Copyright: (c) David Webster |
65571936 | 9 | // Licence: wxWindows licence |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_DIALOG_H_ | |
13 | #define _WX_DIALOG_H_ | |
14 | ||
0e320a79 DW |
15 | #include "wx/panel.h" |
16 | ||
edf1dfa1 | 17 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; |
0e320a79 | 18 | |
598dc9b7 SN |
19 | class WXDLLEXPORT wxDialogModalData; |
20 | ||
d608dde1 | 21 | // |
0e320a79 | 22 | // Dialog boxes |
d608dde1 | 23 | // |
54da4255 | 24 | class WXDLLEXPORT wxDialog: public wxDialogBase |
0e320a79 | 25 | { |
0e320a79 | 26 | public: |
54da4255 | 27 | |
d608dde1 | 28 | inline wxDialog() { Init(); } |
54da4255 | 29 | |
86dc2301 SN |
30 | // full ctor |
31 | wxDialog(wxWindow *parent, wxWindowID id, | |
32 | const wxString& title, | |
33 | const wxPoint& pos = wxDefaultPosition, | |
34 | const wxSize& size = wxDefaultSize, | |
35 | long style = wxDEFAULT_DIALOG_STYLE, | |
36 | const wxString& name = wxDialogNameStr) | |
0e320a79 | 37 | { |
86dc2301 | 38 | Init(); |
0e320a79 | 39 | |
86dc2301 | 40 | (void)Create(parent, id, title, pos, size, style, name); |
0e320a79 DW |
41 | } |
42 | ||
d608dde1 DW |
43 | bool Create( wxWindow* pParent |
44 | ,wxWindowID vId | |
45 | ,const wxString& rsTitle | |
46 | ,const wxPoint& rPos = wxDefaultPosition | |
47 | ,const wxSize& rSize = wxDefaultSize | |
48 | ,long lStyle = wxDEFAULT_DIALOG_STYLE | |
49 | ,const wxString& rsName = wxDialogNameStr | |
54da4255 | 50 | ); |
86dc2301 | 51 | virtual ~wxDialog(); |
0e320a79 | 52 | |
86dc2301 SN |
53 | // return true if we're showing the dialog modally |
54 | virtual bool IsModal() const { return m_modalData != NULL; } | |
fb46a9a6 | 55 | |
86dc2301 | 56 | // show the dialog modally and return the value passed to EndModal() |
3011bf2b DW |
57 | virtual int ShowModal(); |
58 | ||
59 | // may be called to terminate the dialog with the given return code | |
60 | virtual void EndModal(int retCode); | |
0e320a79 | 61 | |
86dc2301 | 62 | // implementation only from now on |
d608dde1 | 63 | // ------------------------------- |
0e320a79 | 64 | |
86dc2301 SN |
65 | // override some base class virtuals |
66 | virtual bool Show(bool show = true); | |
3011bf2b | 67 | |
d608dde1 DW |
68 | // |
69 | // Event handlers | |
70 | // | |
d608dde1 DW |
71 | void OnCharHook(wxKeyEvent& rEvent); |
72 | void OnCloseWindow(wxCloseEvent& rEvent); | |
0e320a79 | 73 | |
d608dde1 | 74 | // |
54da4255 | 75 | // Standard buttons |
d608dde1 DW |
76 | // |
77 | void OnOK(wxCommandEvent& rEvent); | |
78 | void OnApply(wxCommandEvent& rEvent); | |
79 | void OnCancel(wxCommandEvent& rEvent); | |
0e320a79 | 80 | |
d608dde1 | 81 | // |
54da4255 | 82 | // Responds to colour changes |
d608dde1 DW |
83 | // |
84 | void OnSysColourChanged(wxSysColourChangedEvent& rEvent); | |
85 | ||
86 | // | |
87 | // Callbacks | |
88 | // | |
89 | virtual MRESULT OS2WindowProc( WXUINT uMessage | |
90 | ,WXWPARAM wParam | |
91 | ,WXLPARAM lParam | |
92 | ); | |
86dc2301 SN |
93 | // obsolete methods |
94 | // ---------------- | |
95 | ||
96 | // Constructor with a modal flag, but no window id - the old convention | |
97 | wxDEPRECATED( wxDialog( wxWindow* pParent | |
98 | ,const wxString& rsTitle | |
99 | ,bool bModal | |
100 | ,int nX = -1 | |
101 | ,int nY = -1 | |
102 | ,int nWidth = 500 | |
103 | ,int nHeight = 500 | |
104 | ,long lStyle = wxDEFAULT_DIALOG_STYLE | |
105 | ,const wxString& rsName = wxDialogNameStr | |
106 | ) ); | |
107 | ||
108 | // just call Show() or ShowModal() | |
109 | wxDEPRECATED( void SetModal(bool bFlag) ); | |
110 | ||
111 | // use IsModal() | |
112 | wxDEPRECATED( bool IsModalShowing() const ); | |
3011bf2b | 113 | |
27476f73 | 114 | protected: |
d608dde1 | 115 | // |
86dc2301 SN |
116 | // find the window to use as parent for this dialog if none has been |
117 | // specified explicitly by the user | |
118 | // | |
119 | // may return NULL | |
d608dde1 | 120 | // |
86dc2301 | 121 | wxWindow *FindSuitableParent() const; |
d608dde1 DW |
122 | |
123 | // | |
124 | // Common part of all ctors | |
125 | // | |
3011bf2b | 126 | void Init(void); |
27476f73 | 127 | |
86dc2301 SN |
128 | // end either modal or modeless dialog |
129 | void EndDialog(int rc); | |
130 | ||
27476f73 | 131 | private: |
d608dde1 | 132 | wxWindow* m_pOldFocus; |
86dc2301 | 133 | bool m_endModalCalled; // allow for closing within InitDialog |
27476f73 | 134 | |
598dc9b7 SN |
135 | // this pointer is non-NULL only while the modal event loop is running |
136 | wxDialogModalData *m_modalData; | |
137 | ||
d608dde1 DW |
138 | // |
139 | // While we are showing a modal dialog we disable the other windows using | |
140 | // this object | |
141 | // | |
142 | class wxWindowDisabler* m_pWindowDisabler; | |
27476f73 | 143 | |
d608dde1 DW |
144 | DECLARE_DYNAMIC_CLASS(wxDialog) |
145 | DECLARE_EVENT_TABLE() | |
86dc2301 | 146 | DECLARE_NO_COPY_CLASS(wxDialog) |
d608dde1 DW |
147 | }; // end of CLASS wxDialog |
148 | ||
149 | #endif // _WX_DIALOG_H_ | |
0e320a79 | 150 |