]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/dialog.h
use iostream.h and not iostream with OpenWatcom (part of patch 910058)
[wxWidgets.git] / include / wx / os2 / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dialog.h
3 // Purpose: wxDialog class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/14/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DIALOG_H_
13 #define _WX_DIALOG_H_
14
15 #include "wx/panel.h"
16
17 WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
18
19 class WXDLLEXPORT wxDialogModalData;
20
21 //
22 // Dialog boxes
23 //
24 class WXDLLEXPORT wxDialog: public wxDialogBase
25 {
26 public:
27
28 inline wxDialog() { Init(); }
29
30 //
31 // Constructor with a modal flag, but no window id - the old convention
32 //
33 inline wxDialog( wxWindow* pParent
34 ,const wxString& rsTitle
35 ,bool bModal
36 ,int nX = -1
37 ,int nY = -1
38 ,int nWidth = 500
39 ,int nHeight = 500
40 ,long lStyle = wxDEFAULT_DIALOG_STYLE
41 ,const wxString& rsName = wxDialogNameStr
42 )
43 {
44 long lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
45
46 Create( pParent
47 ,-1
48 ,rsTitle
49 ,wxPoint(nX, nY)
50 ,wxSize(nWidth, nHeight)
51 ,lStyle | lModalStyle
52 ,rsName
53 );
54 }
55
56 //
57 // Constructor with no modal flag - the new convention.
58 //
59 inline wxDialog( wxWindow* pParent
60 ,wxWindowID vId
61 ,const wxString& rsTitle
62 ,const wxPoint& rPos = wxDefaultPosition
63 ,const wxSize& rSize = wxDefaultSize
64 ,long lStyle = wxDEFAULT_DIALOG_STYLE
65 ,const wxString& rsName = wxDialogNameStr
66 )
67 {
68 Create( pParent
69 ,vId
70 ,rsTitle
71 ,rPos
72 ,rSize
73 ,lStyle
74 ,rsName
75 );
76 }
77
78 bool Create( wxWindow* pParent
79 ,wxWindowID vId
80 ,const wxString& rsTitle
81 ,const wxPoint& rPos = wxDefaultPosition
82 ,const wxSize& rSize = wxDefaultSize
83 ,long lStyle = wxDEFAULT_DIALOG_STYLE
84 ,const wxString& rsName = wxDialogNameStr
85 );
86 ~wxDialog();
87
88 void SetModal(bool bFlag);
89 virtual bool IsModal(void) const;
90
91 // For now, same as Show(TRUE) but returns return code
92 virtual int ShowModal();
93
94 // may be called to terminate the dialog with the given return code
95 virtual void EndModal(int retCode);
96
97 //
98 // Returns TRUE if we're in a modal loop
99 //
100 bool IsModalShowing() const;
101
102 //
103 // Implementation only from now on
104 // -------------------------------
105 //
106
107 //
108 // Override some base class virtuals
109 //
110 virtual bool Show(bool bShow);
111
112 //
113 // Event handlers
114 //
115 void OnCharHook(wxKeyEvent& rEvent);
116 void OnCloseWindow(wxCloseEvent& rEvent);
117
118 //
119 // Standard buttons
120 //
121 void OnOK(wxCommandEvent& rEvent);
122 void OnApply(wxCommandEvent& rEvent);
123 void OnCancel(wxCommandEvent& rEvent);
124
125 //
126 // Responds to colour changes
127 //
128 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
129
130 //
131 // Callbacks
132 //
133 virtual MRESULT OS2WindowProc( WXUINT uMessage
134 ,WXWPARAM wParam
135 ,WXLPARAM lParam
136 );
137
138 protected:
139 //
140 // Show modal dialog and enter modal loop
141 //
142 void DoShowModal(void);
143
144 //
145 // Common part of all ctors
146 //
147 void Init(void);
148
149 private:
150 wxWindow* m_pOldFocus;
151
152 // this pointer is non-NULL only while the modal event loop is running
153 wxDialogModalData *m_modalData;
154
155 //
156 // While we are showing a modal dialog we disable the other windows using
157 // this object
158 //
159 class wxWindowDisabler* m_pWindowDisabler;
160
161 DECLARE_DYNAMIC_CLASS(wxDialog)
162 DECLARE_EVENT_TABLE()
163 }; // end of CLASS wxDialog
164
165 #endif // _WX_DIALOG_H_
166