]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/dialog.h
added conversion routines to CIconHandle
[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 bModal = FALSE;
45 Create( pParent
46 ,-1
47 ,rsTitle
48 ,wxPoint(nX, nY)
49 ,wxSize(nWidth, nHeight)
50 ,lStyle | lModalStyle
51 ,rsName
52 );
53 }
54
55 //
56 // Constructor with no modal flag - the new convention.
57 //
58 inline wxDialog( wxWindow* pParent
59 ,wxWindowID vId
60 ,const wxString& rsTitle
61 ,const wxPoint& rPos = wxDefaultPosition
62 ,const wxSize& rSize = wxDefaultSize
63 ,long lStyle = wxDEFAULT_DIALOG_STYLE
64 ,const wxString& rsName = wxDialogNameStr
65 )
66 {
67 Create( pParent
68 ,vId
69 ,rsTitle
70 ,rPos
71 ,rSize
72 ,lStyle
73 ,rsName
74 );
75 }
76
77 bool Create( wxWindow* pParent
78 ,wxWindowID vId
79 ,const wxString& rsTitle
80 ,const wxPoint& rPos = wxDefaultPosition
81 ,const wxSize& rSize = wxDefaultSize
82 ,long lStyle = wxDEFAULT_DIALOG_STYLE
83 ,const wxString& rsName = wxDialogNameStr
84 );
85 ~wxDialog();
86
87 virtual bool Destroy(void);
88 virtual bool Show(bool bShow);
89 virtual void Iconize(bool bIconize);
90 virtual bool IsIconized(void) const;
91
92 virtual bool IsTopLevel(void) const { return TRUE; }
93
94 void SetModal(bool bFlag);
95 virtual bool IsModal(void) const;
96
97 //
98 // For now, same as Show(TRUE) but returns return code
99 //
100 virtual int ShowModal(void);
101 virtual void EndModal(int nRetCode);
102
103 //
104 // Returns TRUE if we're in a modal loop
105 //
106 bool IsModalShowing() const;
107
108 #if WXWIN_COMPATIBILITY
109 bool Iconized() const { return IsIconized(); };
110 #endif
111
112 //
113 // Implementation only from now on
114 // -------------------------------
115 //
116
117 //
118 // Event handlers
119 //
120 bool OnClose(void);
121 void OnCharHook(wxKeyEvent& rEvent);
122 void OnCloseWindow(wxCloseEvent& rEvent);
123
124 //
125 // May be called to terminate the dialog with the given return code
126 //
127
128 //
129 // Standard buttons
130 //
131 void OnOK(wxCommandEvent& rEvent);
132 void OnApply(wxCommandEvent& rEvent);
133 void OnCancel(wxCommandEvent& rEvent);
134
135 //
136 // Responds to colour changes
137 //
138 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
139
140 //
141 // Callbacks
142 //
143 virtual MRESULT OS2WindowProc( WXUINT uMessage
144 ,WXWPARAM wParam
145 ,WXLPARAM lParam
146 );
147 protected:
148 //
149 // Override more base class virtuals
150 //
151 virtual void DoSetClientSize( int nWidth
152 ,int nHeight
153 );
154 virtual void DoGetPosition( int* pnX
155 ,int* pnY
156 ) const;
157 //
158 // Show modal dialog and enter modal loop
159 //
160 void DoShowModal(void);
161
162 //
163 // Common part of all ctors
164 //
165 void Init();
166
167 private:
168 wxWindow* m_pOldFocus;
169
170 //
171 // While we are showing a modal dialog we disable the other windows using
172 // this object
173 //
174 class wxWindowDisabler* m_pWindowDisabler;
175
176 DECLARE_DYNAMIC_CLASS(wxDialog)
177 DECLARE_EVENT_TABLE()
178 }; // end of CLASS wxDialog
179
180 #endif // _WX_DIALOG_H_
181