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"
22 #include "wx/dialog.h"
25 #include "wx/valtext.h"
28 class WXDLLEXPORT wxTextCtrl
;
30 extern WXDLLEXPORT_DATA(const wxChar
*) wxGetTextFromUserPromptStr
;
31 extern WXDLLEXPORT_DATA(const wxChar
*) wxGetPasswordFromUserPromptStr
;
33 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
35 // ----------------------------------------------------------------------------
36 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
37 // ----------------------------------------------------------------------------
39 class WXDLLEXPORT wxTextEntryDialog
: public wxDialog
42 wxTextEntryDialog(wxWindow
*parent
,
43 const wxString
& message
,
44 const wxString
& caption
= wxGetTextFromUserPromptStr
,
45 const wxString
& value
= wxEmptyString
,
46 long style
= wxTextEntryDialogStyle
,
47 const wxPoint
& pos
= wxDefaultPosition
);
49 void SetValue(const wxString
& val
);
50 wxString
GetValue() const { return m_value
; }
53 void SetTextValidator( wxTextValidator
& validator
);
54 void SetTextValidator( long style
= wxFILTER_NONE
);
55 wxTextValidator
* GetTextValidator() { return (wxTextValidator
*)m_textctrl
->GetValidator(); }
59 // implementation only
60 void OnOK(wxCommandEvent
& event
);
63 wxTextCtrl
*m_textctrl
;
69 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog
)
70 DECLARE_NO_COPY_CLASS(wxTextEntryDialog
)
73 // ----------------------------------------------------------------------------
74 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
75 // ----------------------------------------------------------------------------
77 class WXDLLEXPORT wxPasswordEntryDialog
: public wxTextEntryDialog
80 wxPasswordEntryDialog(wxWindow
*parent
,
81 const wxString
& message
,
82 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
83 const wxString
& value
= wxEmptyString
,
84 long style
= wxTextEntryDialogStyle
,
85 const wxPoint
& pos
= wxDefaultPosition
);
87 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog
)
88 DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog
)
91 // ----------------------------------------------------------------------------
92 // function to get a string from user
93 // ----------------------------------------------------------------------------
96 wxGetTextFromUser(const wxString
& message
,
97 const wxString
& caption
= wxGetTextFromUserPromptStr
,
98 const wxString
& default_value
= wxEmptyString
,
99 wxWindow
*parent
= (wxWindow
*) NULL
,
100 wxCoord x
= wxDefaultCoord
,
101 wxCoord y
= wxDefaultCoord
,
105 wxGetPasswordFromUser(const wxString
& message
,
106 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
107 const wxString
& default_value
= wxEmptyString
,
108 wxWindow
*parent
= (wxWindow
*) NULL
,
109 wxCoord x
= wxDefaultCoord
,
110 wxCoord y
= wxDefaultCoord
,