]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/dialog.h | |
3 | // Purpose: wxDialog class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/14/99 | |
7 | // Copyright: (c) David Webster | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_DIALOG_H_ | |
12 | #define _WX_DIALOG_H_ | |
13 | ||
14 | #include "wx/panel.h" | |
15 | ||
16 | WXDLLIMPEXP_DATA_CORE(extern const char) wxDialogNameStr[]; | |
17 | ||
18 | class WXDLLIMPEXP_FWD_CORE wxDialogModalData; | |
19 | ||
20 | // | |
21 | // Dialog boxes | |
22 | // | |
23 | class WXDLLIMPEXP_CORE wxDialog: public wxDialogBase | |
24 | { | |
25 | public: | |
26 | ||
27 | inline wxDialog() { Init(); } | |
28 | ||
29 | // full ctor | |
30 | wxDialog(wxWindow *parent, wxWindowID id, | |
31 | const wxString& title, | |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, | |
34 | long style = wxDEFAULT_DIALOG_STYLE, | |
35 | const wxString& name = wxDialogNameStr) | |
36 | { | |
37 | Init(); | |
38 | ||
39 | (void)Create(parent, id, title, pos, size, style, name); | |
40 | } | |
41 | ||
42 | bool Create( wxWindow* pParent | |
43 | ,wxWindowID vId | |
44 | ,const wxString& rsTitle | |
45 | ,const wxPoint& rPos = wxDefaultPosition | |
46 | ,const wxSize& rSize = wxDefaultSize | |
47 | ,long lStyle = wxDEFAULT_DIALOG_STYLE | |
48 | ,const wxString& rsName = wxDialogNameStr | |
49 | ); | |
50 | virtual ~wxDialog(); | |
51 | ||
52 | // return true if we're showing the dialog modally | |
53 | virtual bool IsModal() const { return m_modalData != NULL; } | |
54 | ||
55 | // show the dialog modally and return the value passed to EndModal() | |
56 | virtual int ShowModal(); | |
57 | ||
58 | // may be called to terminate the dialog with the given return code | |
59 | virtual void EndModal(int retCode); | |
60 | ||
61 | // implementation only from now on | |
62 | // ------------------------------- | |
63 | ||
64 | // override some base class virtuals | |
65 | virtual bool Show(bool show = true); | |
66 | ||
67 | // | |
68 | // Callbacks | |
69 | // | |
70 | virtual MRESULT OS2WindowProc( WXUINT uMessage | |
71 | ,WXWPARAM wParam | |
72 | ,WXLPARAM lParam | |
73 | ); | |
74 | #if WXWIN_COMPATIBILITY_2_6 | |
75 | ||
76 | // Constructor with a modal flag, but no window id - the old convention | |
77 | wxDEPRECATED( wxDialog( wxWindow* pParent | |
78 | ,const wxString& rsTitle | |
79 | ,bool bModal | |
80 | ,int nX = -1 | |
81 | ,int nY = -1 | |
82 | ,int nWidth = 500 | |
83 | ,int nHeight = 500 | |
84 | ,long lStyle = wxDEFAULT_DIALOG_STYLE | |
85 | ,const wxString& rsName = wxDialogNameStr | |
86 | ) ); | |
87 | ||
88 | // just call Show() or ShowModal() | |
89 | wxDEPRECATED( void SetModal(bool bFlag) ); | |
90 | ||
91 | // use IsModal() | |
92 | wxDEPRECATED( bool IsModalShowing() const ); | |
93 | ||
94 | #endif // WXWIN_COMPATIBILITY_2_6 | |
95 | ||
96 | protected: | |
97 | // | |
98 | // Common part of all ctors | |
99 | // | |
100 | void Init(void); | |
101 | ||
102 | private: | |
103 | wxWindow* m_pOldFocus; | |
104 | bool m_endModalCalled; // allow for closing within InitDialog | |
105 | ||
106 | // this pointer is non-NULL only while the modal event loop is running | |
107 | wxDialogModalData *m_modalData; | |
108 | ||
109 | // | |
110 | // While we are showing a modal dialog we disable the other windows using | |
111 | // this object | |
112 | // | |
113 | class wxWindowDisabler* m_pWindowDisabler; | |
114 | ||
115 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
116 | wxDECLARE_NO_COPY_CLASS(wxDialog); | |
117 | }; // end of CLASS wxDialog | |
118 | ||
119 | #endif // _WX_DIALOG_H_ |