1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTextEntryDialog class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TEXTDLGG_H_
13 #define _WX_TEXTDLGG_H_
19 #include "wx/dialog.h"
22 #include "wx/valtext.h"
23 #include "wx/textctrl.h"
26 class WXDLLIMPEXP_FWD_CORE wxTextCtrl
;
28 extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr
[];
29 extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr
[];
31 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
33 // ----------------------------------------------------------------------------
34 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
35 // ----------------------------------------------------------------------------
37 class WXDLLIMPEXP_CORE wxTextEntryDialog
: public wxDialog
40 wxTextEntryDialog(wxWindow
*parent
,
41 const wxString
& message
,
42 const wxString
& caption
= wxGetTextFromUserPromptStr
,
43 const wxString
& value
= wxEmptyString
,
44 long style
= wxTextEntryDialogStyle
,
45 const wxPoint
& pos
= wxDefaultPosition
);
47 void SetValue(const wxString
& val
);
48 wxString
GetValue() const { return m_value
; }
51 void SetTextValidator( const wxTextValidator
& validator
);
52 #if WXWIN_COMPATIBILITY_2_8
53 wxDEPRECATED( void SetTextValidator( long style
) );
55 void SetTextValidator( wxTextValidatorStyle style
= wxFILTER_NONE
);
56 wxTextValidator
* GetTextValidator() { return (wxTextValidator
*)m_textctrl
->GetValidator(); }
60 // implementation only
61 void OnOK(wxCommandEvent
& event
);
64 wxTextCtrl
*m_textctrl
;
70 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog
)
71 DECLARE_NO_COPY_CLASS(wxTextEntryDialog
)
74 // ----------------------------------------------------------------------------
75 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
76 // ----------------------------------------------------------------------------
78 class WXDLLIMPEXP_CORE wxPasswordEntryDialog
: public wxTextEntryDialog
81 wxPasswordEntryDialog(wxWindow
*parent
,
82 const wxString
& message
,
83 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
84 const wxString
& value
= wxEmptyString
,
85 long style
= wxTextEntryDialogStyle
,
86 const wxPoint
& pos
= wxDefaultPosition
);
88 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog
)
89 DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog
)
92 // ----------------------------------------------------------------------------
93 // function to get a string from user
94 // ----------------------------------------------------------------------------
96 WXDLLIMPEXP_CORE wxString
97 wxGetTextFromUser(const wxString
& message
,
98 const wxString
& caption
= wxGetTextFromUserPromptStr
,
99 const wxString
& default_value
= wxEmptyString
,
100 wxWindow
*parent
= NULL
,
101 wxCoord x
= wxDefaultCoord
,
102 wxCoord y
= wxDefaultCoord
,
105 WXDLLIMPEXP_CORE wxString
106 wxGetPasswordFromUser(const wxString
& message
,
107 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
108 const wxString
& default_value
= wxEmptyString
,
109 wxWindow
*parent
= NULL
,
110 wxCoord x
= wxDefaultCoord
,
111 wxCoord y
= wxDefaultCoord
,
116 #endif // _WX_TEXTDLGG_H_