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 void SetTextValidator( long style
= wxFILTER_NONE
);
53 wxTextValidator
* GetTextValidator() { return (wxTextValidator
*)m_textctrl
->GetValidator(); }
57 // implementation only
58 void OnOK(wxCommandEvent
& event
);
61 wxTextCtrl
*m_textctrl
;
67 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog
)
68 DECLARE_NO_COPY_CLASS(wxTextEntryDialog
)
71 // ----------------------------------------------------------------------------
72 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
73 // ----------------------------------------------------------------------------
75 class WXDLLIMPEXP_CORE wxPasswordEntryDialog
: public wxTextEntryDialog
78 wxPasswordEntryDialog(wxWindow
*parent
,
79 const wxString
& message
,
80 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
81 const wxString
& value
= wxEmptyString
,
82 long style
= wxTextEntryDialogStyle
,
83 const wxPoint
& pos
= wxDefaultPosition
);
85 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog
)
86 DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog
)
89 // ----------------------------------------------------------------------------
90 // function to get a string from user
91 // ----------------------------------------------------------------------------
93 WXDLLIMPEXP_CORE wxString
94 wxGetTextFromUser(const wxString
& message
,
95 const wxString
& caption
= wxGetTextFromUserPromptStr
,
96 const wxString
& default_value
= wxEmptyString
,
97 wxWindow
*parent
= (wxWindow
*) NULL
,
98 wxCoord x
= wxDefaultCoord
,
99 wxCoord y
= wxDefaultCoord
,
102 WXDLLIMPEXP_CORE wxString
103 wxGetPasswordFromUser(const wxString
& message
,
104 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
105 const wxString
& default_value
= wxEmptyString
,
106 wxWindow
*parent
= (wxWindow
*) NULL
,
107 wxCoord x
= wxDefaultCoord
,
108 wxCoord y
= wxDefaultCoord
,
113 #endif // _WX_TEXTDLGG_H_