]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/dialog.h
compilation fix for recent commit
[wxWidgets.git] / include / wx / os2 / dialog.h
CommitLineData
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
DW
8// Copyright: (c) David Webster
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
54da4255 17WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
0e320a79 18
d608dde1 19//
0e320a79 20// Dialog boxes
d608dde1 21//
54da4255 22class WXDLLEXPORT wxDialog: public wxDialogBase
0e320a79 23{
0e320a79 24public:
54da4255 25
d608dde1 26 inline wxDialog() { Init(); }
54da4255 27
d608dde1 28 //
54da4255 29 // Constructor with a modal flag, but no window id - the old convention
d608dde1
DW
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
54da4255 40 )
0e320a79 41 {
d608dde1
DW
42 long lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
43
afa59b4e 44 bModal = FALSE;
d608dde1
DW
45 Create( pParent
46 ,-1
47 ,rsTitle
48 ,wxPoint(nX, nY)
49 ,wxSize(nWidth, nHeight)
50 ,lStyle | lModalStyle
51 ,rsName
52 );
0e320a79
DW
53 }
54
d608dde1 55 //
0e320a79 56 // Constructor with no modal flag - the new convention.
d608dde1
DW
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
54da4255 65 )
0e320a79 66 {
d608dde1
DW
67 Create( pParent
68 ,vId
69 ,rsTitle
70 ,rPos
71 ,rSize
72 ,lStyle
73 ,rsName
74 );
0e320a79
DW
75 }
76
d608dde1
DW
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
54da4255 84 );
0e320a79
DW
85 ~wxDialog();
86
d608dde1
DW
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; }
fb46a9a6 93
d608dde1
DW
94 void SetModal(bool bFlag);
95 virtual bool IsModal(void) const;
fb46a9a6 96
d608dde1
DW
97 //
98 // For now, same as Show(TRUE) but returns return code
99 //
100 virtual int ShowModal(void);
101 virtual void EndModal(int nRetCode);
0e320a79 102
d608dde1
DW
103 //
104 // Returns TRUE if we're in a modal loop
105 //
106 bool IsModalShowing() const;
1408104d 107
fb46a9a6
DW
108#if WXWIN_COMPATIBILITY
109 bool Iconized() const { return IsIconized(); };
110#endif
111
d608dde1
DW
112 //
113 // Implementation only from now on
114 // -------------------------------
115 //
0e320a79 116
d608dde1
DW
117 //
118 // Event handlers
119 //
120 bool OnClose(void);
121 void OnCharHook(wxKeyEvent& rEvent);
122 void OnCloseWindow(wxCloseEvent& rEvent);
0e320a79 123
d608dde1
DW
124 //
125 // May be called to terminate the dialog with the given return code
126 //
0e320a79 127
d608dde1 128 //
54da4255 129 // Standard buttons
d608dde1
DW
130 //
131 void OnOK(wxCommandEvent& rEvent);
132 void OnApply(wxCommandEvent& rEvent);
133 void OnCancel(wxCommandEvent& rEvent);
0e320a79 134
d608dde1 135 //
54da4255 136 // Responds to colour changes
d608dde1
DW
137 //
138 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
139
140 //
141 // Callbacks
142 //
143 virtual MRESULT OS2WindowProc( WXUINT uMessage
144 ,WXWPARAM wParam
145 ,WXLPARAM lParam
146 );
27476f73 147protected:
d608dde1
DW
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();
27476f73
DW
166
167private:
d608dde1 168 wxWindow* m_pOldFocus;
27476f73 169
d608dde1
DW
170 //
171 // While we are showing a modal dialog we disable the other windows using
172 // this object
173 //
174 class wxWindowDisabler* m_pWindowDisabler;
27476f73 175
d608dde1
DW
176 DECLARE_DYNAMIC_CLASS(wxDialog)
177 DECLARE_EVENT_TABLE()
178}; // end of CLASS wxDialog
179
180#endif // _WX_DIALOG_H_
0e320a79 181