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__
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "textdlgg.h"
23 #include "wx/dialog.h"
26 #include "wx/valtext.h"
29 class WXDLLEXPORT wxTextCtrl
;
31 extern WXDLLEXPORT_DATA(const wxChar
*) wxGetTextFromUserPromptStr
;
32 extern WXDLLEXPORT_DATA(const wxChar
*) wxGetPasswordFromUserPromptStr
;
34 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
36 // ----------------------------------------------------------------------------
37 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
38 // ----------------------------------------------------------------------------
40 class WXDLLEXPORT wxTextEntryDialog
: public wxDialog
43 wxTextEntryDialog(wxWindow
*parent
,
44 const wxString
& message
,
45 const wxString
& caption
= wxGetTextFromUserPromptStr
,
46 const wxString
& value
= wxEmptyString
,
47 long style
= wxTextEntryDialogStyle
,
48 const wxPoint
& pos
= wxDefaultPosition
);
50 void SetValue(const wxString
& val
);
51 wxString
GetValue() const { return m_value
; }
54 void SetTextValidator( wxTextValidator
& validator
);
55 void SetTextValidator( long 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 WXDLLEXPORT 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 // ----------------------------------------------------------------------------
97 wxGetTextFromUser(const wxString
& message
,
98 const wxString
& caption
= wxGetTextFromUserPromptStr
,
99 const wxString
& default_value
= wxEmptyString
,
100 wxWindow
*parent
= (wxWindow
*) NULL
,
101 wxCoord x
= wxDefaultCoord
,
102 wxCoord y
= wxDefaultCoord
,
106 wxGetPasswordFromUser(const wxString
& message
,
107 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
108 const wxString
& default_value
= wxEmptyString
,
109 wxWindow
*parent
= (wxWindow
*) NULL
,
110 wxCoord x
= wxDefaultCoord
,
111 wxCoord y
= wxDefaultCoord
,