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