]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/dialog.h
MSVC 5 fix.
[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
598dc9b7
SN
19class WXDLLEXPORT wxDialogModalData;
20
d608dde1 21//
0e320a79 22// Dialog boxes
d608dde1 23//
54da4255 24class WXDLLEXPORT wxDialog: public wxDialogBase
0e320a79 25{
0e320a79 26public:
54da4255 27
d608dde1 28 inline wxDialog() { Init(); }
54da4255 29
d608dde1 30 //
54da4255 31 // Constructor with a modal flag, but no window id - the old convention
d608dde1
DW
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
54da4255 42 )
0e320a79 43 {
d608dde1
DW
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 );
0e320a79
DW
54 }
55
d608dde1 56 //
0e320a79 57 // Constructor with no modal flag - the new convention.
d608dde1
DW
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
54da4255 66 )
0e320a79 67 {
d608dde1
DW
68 Create( pParent
69 ,vId
70 ,rsTitle
71 ,rPos
72 ,rSize
73 ,lStyle
74 ,rsName
75 );
0e320a79
DW
76 }
77
d608dde1
DW
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
54da4255 85 );
0e320a79
DW
86 ~wxDialog();
87
3011bf2b 88 void SetModal(bool bFlag);
d608dde1 89 virtual bool IsModal(void) const;
fb46a9a6 90
d608dde1 91 // For now, same as Show(TRUE) but returns return code
3011bf2b
DW
92 virtual int ShowModal();
93
94 // may be called to terminate the dialog with the given return code
95 virtual void EndModal(int retCode);
0e320a79 96
d608dde1
DW
97 //
98 // Returns TRUE if we're in a modal loop
99 //
3011bf2b 100 bool IsModalShowing() const;
fb46a9a6 101
d608dde1
DW
102 //
103 // Implementation only from now on
104 // -------------------------------
105 //
0e320a79 106
3011bf2b
DW
107 //
108 // Override some base class virtuals
109 //
110 virtual bool Show(bool bShow);
111
d608dde1
DW
112 //
113 // Event handlers
114 //
d608dde1
DW
115 void OnCharHook(wxKeyEvent& rEvent);
116 void OnCloseWindow(wxCloseEvent& rEvent);
0e320a79 117
d608dde1 118 //
54da4255 119 // Standard buttons
d608dde1
DW
120 //
121 void OnOK(wxCommandEvent& rEvent);
122 void OnApply(wxCommandEvent& rEvent);
123 void OnCancel(wxCommandEvent& rEvent);
0e320a79 124
d608dde1 125 //
54da4255 126 // Responds to colour changes
d608dde1
DW
127 //
128 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
129
130 //
131 // Callbacks
132 //
133 virtual MRESULT OS2WindowProc( WXUINT uMessage
134 ,WXWPARAM wParam
135 ,WXLPARAM lParam
136 );
3011bf2b 137
27476f73 138protected:
d608dde1 139 //
d608dde1
DW
140 // Show modal dialog and enter modal loop
141 //
142 void DoShowModal(void);
143
144 //
145 // Common part of all ctors
146 //
3011bf2b 147 void Init(void);
27476f73
DW
148
149private:
d608dde1 150 wxWindow* m_pOldFocus;
27476f73 151
598dc9b7
SN
152 // this pointer is non-NULL only while the modal event loop is running
153 wxDialogModalData *m_modalData;
154
d608dde1
DW
155 //
156 // While we are showing a modal dialog we disable the other windows using
157 // this object
158 //
159 class wxWindowDisabler* m_pWindowDisabler;
27476f73 160
d608dde1
DW
161 DECLARE_DYNAMIC_CLASS(wxDialog)
162 DECLARE_EVENT_TABLE()
163}; // end of CLASS wxDialog
164
165#endif // _WX_DIALOG_H_
0e320a79 166