]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/dialog.h
allow changing the page from keyboard in property sheet like controls even when the...
[wxWidgets.git] / include / wx / os2 / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/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 wxChar) wxDialogNameStr[];
18
19 class WXDLLEXPORT wxDialogModalData;
20
21 //
22 // Dialog boxes
23 //
24 class WXDLLEXPORT wxDialog: public wxDialogBase
25 {
26 public:
27
28 inline wxDialog() { Init(); }
29
30 // full ctor
31 wxDialog(wxWindow *parent, wxWindowID id,
32 const wxString& title,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 long style = wxDEFAULT_DIALOG_STYLE,
36 const wxString& name = wxDialogNameStr)
37 {
38 Init();
39
40 (void)Create(parent, id, title, pos, size, style, name);
41 }
42
43 bool Create( wxWindow* pParent
44 ,wxWindowID vId
45 ,const wxString& rsTitle
46 ,const wxPoint& rPos = wxDefaultPosition
47 ,const wxSize& rSize = wxDefaultSize
48 ,long lStyle = wxDEFAULT_DIALOG_STYLE
49 ,const wxString& rsName = wxDialogNameStr
50 );
51 virtual ~wxDialog();
52
53 // return true if we're showing the dialog modally
54 virtual bool IsModal() const { return m_modalData != NULL; }
55
56 // show the dialog modally and return the value passed to EndModal()
57 virtual int ShowModal();
58
59 // may be called to terminate the dialog with the given return code
60 virtual void EndModal(int retCode);
61
62 // implementation only from now on
63 // -------------------------------
64
65 // override some base class virtuals
66 virtual bool Show(bool show = true);
67
68 //
69 // Event handlers
70 //
71 void OnCharHook(wxKeyEvent& rEvent);
72 void OnCloseWindow(wxCloseEvent& rEvent);
73
74 //
75 // Standard buttons
76 //
77 void OnOK(wxCommandEvent& rEvent);
78 void OnApply(wxCommandEvent& rEvent);
79 void OnCancel(wxCommandEvent& rEvent);
80
81 //
82 // Responds to colour changes
83 //
84 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
85
86 //
87 // Callbacks
88 //
89 virtual MRESULT OS2WindowProc( WXUINT uMessage
90 ,WXWPARAM wParam
91 ,WXLPARAM lParam
92 );
93 #if WXWIN_COMPATIBILITY_2_6
94
95 // Constructor with a modal flag, but no window id - the old convention
96 wxDEPRECATED( wxDialog( wxWindow* pParent
97 ,const wxString& rsTitle
98 ,bool bModal
99 ,int nX = -1
100 ,int nY = -1
101 ,int nWidth = 500
102 ,int nHeight = 500
103 ,long lStyle = wxDEFAULT_DIALOG_STYLE
104 ,const wxString& rsName = wxDialogNameStr
105 ) );
106
107 // just call Show() or ShowModal()
108 wxDEPRECATED( void SetModal(bool bFlag) );
109
110 // use IsModal()
111 wxDEPRECATED( bool IsModalShowing() const );
112
113 #endif // WXWIN_COMPATIBILITY_2_6
114
115 protected:
116 //
117 // find the window to use as parent for this dialog if none has been
118 // specified explicitly by the user
119 //
120 // may return NULL
121 //
122 wxWindow *FindSuitableParent() const;
123
124 //
125 // Common part of all ctors
126 //
127 void Init(void);
128
129 // end either modal or modeless dialog
130 void EndDialog(int rc);
131
132 private:
133 wxWindow* m_pOldFocus;
134 bool m_endModalCalled; // allow for closing within InitDialog
135
136 // this pointer is non-NULL only while the modal event loop is running
137 wxDialogModalData *m_modalData;
138
139 //
140 // While we are showing a modal dialog we disable the other windows using
141 // this object
142 //
143 class wxWindowDisabler* m_pWindowDisabler;
144
145 DECLARE_DYNAMIC_CLASS(wxDialog)
146 DECLARE_EVENT_TABLE()
147 DECLARE_NO_COPY_CLASS(wxDialog)
148 }; // end of CLASS wxDialog
149
150 #endif // _WX_DIALOG_H_