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