1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/textdlgg.h
3 // Purpose: wxTextEntryDialog class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_TEXTDLGG_H_
12 #define _WX_TEXTDLGG_H_
18 #include "wx/dialog.h"
21 #include "wx/valtext.h"
22 #include "wx/textctrl.h"
25 class WXDLLIMPEXP_FWD_CORE wxTextCtrl
;
27 extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr
[];
28 extern WXDLLIMPEXP_DATA_CORE(const char) 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 WXDLLIMPEXP_CORE wxTextEntryDialog
: public wxDialog
44 wxTextEntryDialog(wxWindow
*parent
,
45 const wxString
& message
,
46 const wxString
& caption
= wxGetTextFromUserPromptStr
,
47 const wxString
& value
= wxEmptyString
,
48 long style
= wxTextEntryDialogStyle
,
49 const wxPoint
& pos
= wxDefaultPosition
)
51 Create(parent
, message
, caption
, value
, style
, pos
);
54 bool Create(wxWindow
*parent
,
55 const wxString
& message
,
56 const wxString
& caption
= wxGetTextFromUserPromptStr
,
57 const wxString
& value
= wxEmptyString
,
58 long style
= wxTextEntryDialogStyle
,
59 const wxPoint
& pos
= wxDefaultPosition
);
61 void SetValue(const wxString
& val
);
62 wxString
GetValue() const { return m_value
; }
64 void SetMaxLength(unsigned long len
);
67 void SetTextValidator( const wxTextValidator
& validator
);
68 #if WXWIN_COMPATIBILITY_2_8
69 wxDEPRECATED( void SetTextValidator( long style
) );
71 void SetTextValidator( wxTextValidatorStyle style
= wxFILTER_NONE
);
72 wxTextValidator
* GetTextValidator() { return (wxTextValidator
*)m_textctrl
->GetValidator(); }
73 #endif // wxUSE_VALIDATORS
75 virtual bool TransferDataToWindow();
76 virtual bool TransferDataFromWindow();
78 // implementation only
79 void OnOK(wxCommandEvent
& event
);
82 wxTextCtrl
*m_textctrl
;
88 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog
)
89 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog
);
92 // ----------------------------------------------------------------------------
93 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
94 // ----------------------------------------------------------------------------
96 class WXDLLIMPEXP_CORE wxPasswordEntryDialog
: public wxTextEntryDialog
99 wxPasswordEntryDialog(wxWindow
*parent
,
100 const wxString
& message
,
101 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
102 const wxString
& value
= wxEmptyString
,
103 long style
= wxTextEntryDialogStyle
,
104 const wxPoint
& pos
= wxDefaultPosition
);
106 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog
)
107 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog
);
110 // ----------------------------------------------------------------------------
111 // function to get a string from user
112 // ----------------------------------------------------------------------------
114 WXDLLIMPEXP_CORE wxString
115 wxGetTextFromUser(const wxString
& message
,
116 const wxString
& caption
= wxGetTextFromUserPromptStr
,
117 const wxString
& default_value
= wxEmptyString
,
118 wxWindow
*parent
= NULL
,
119 wxCoord x
= wxDefaultCoord
,
120 wxCoord y
= wxDefaultCoord
,
123 WXDLLIMPEXP_CORE wxString
124 wxGetPasswordFromUser(const wxString
& message
,
125 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
126 const wxString
& default_value
= wxEmptyString
,
127 wxWindow
*parent
= NULL
,
128 wxCoord x
= wxDefaultCoord
,
129 wxCoord y
= wxDefaultCoord
,
134 #endif // _WX_TEXTDLGG_H_