1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTextEntryDialog class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __TEXTDLGH_G__
13 #define __TEXTDLGH_G__
19 #include "wx/dialog.h"
22 #include "wx/valtext.h"
25 class WXDLLEXPORT wxTextCtrl
;
27 extern WXDLLEXPORT_DATA(const wxChar
) wxGetTextFromUserPromptStr
[];
28 extern WXDLLEXPORT_DATA(const wxChar
) wxGetPasswordFromUserPromptStr
[];
30 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
32 // ----------------------------------------------------------------------------
33 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
34 // ----------------------------------------------------------------------------
36 class WXDLLEXPORT wxTextEntryDialog
: public wxDialog
39 wxTextEntryDialog(wxWindow
*parent
,
40 const wxString
& message
,
41 const wxString
& caption
= wxGetTextFromUserPromptStr
,
42 const wxString
& value
= wxEmptyString
,
43 long style
= wxTextEntryDialogStyle
,
44 const wxPoint
& pos
= wxDefaultPosition
);
46 void SetValue(const wxString
& val
);
47 wxString
GetValue() const { return m_value
; }
50 void SetTextValidator( const wxTextValidator
& validator
);
51 void SetTextValidator( long style
= wxFILTER_NONE
);
52 wxTextValidator
* GetTextValidator() { return (wxTextValidator
*)m_textctrl
->GetValidator(); }
56 // implementation only
57 void OnOK(wxCommandEvent
& event
);
60 wxTextCtrl
*m_textctrl
;
66 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog
)
67 DECLARE_NO_COPY_CLASS(wxTextEntryDialog
)
70 // ----------------------------------------------------------------------------
71 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
72 // ----------------------------------------------------------------------------
74 class WXDLLEXPORT wxPasswordEntryDialog
: public wxTextEntryDialog
77 wxPasswordEntryDialog(wxWindow
*parent
,
78 const wxString
& message
,
79 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
80 const wxString
& value
= wxEmptyString
,
81 long style
= wxTextEntryDialogStyle
,
82 const wxPoint
& pos
= wxDefaultPosition
);
84 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog
)
85 DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog
)
88 // ----------------------------------------------------------------------------
89 // function to get a string from user
90 // ----------------------------------------------------------------------------
93 wxGetTextFromUser(const wxString
& message
,
94 const wxString
& caption
= wxGetTextFromUserPromptStr
,
95 const wxString
& default_value
= wxEmptyString
,
96 wxWindow
*parent
= (wxWindow
*) NULL
,
97 wxCoord x
= wxDefaultCoord
,
98 wxCoord y
= wxDefaultCoord
,
102 wxGetPasswordFromUser(const wxString
& message
,
103 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
104 const wxString
& default_value
= wxEmptyString
,
105 wxWindow
*parent
= (wxWindow
*) NULL
,
106 wxCoord x
= wxDefaultCoord
,
107 wxCoord y
= wxDefaultCoord
,