1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/textdlgg.h
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
45 wxTextEntryDialog(wxWindow
*parent
,
46 const wxString
& message
,
47 const wxString
& caption
= wxGetTextFromUserPromptStr
,
48 const wxString
& value
= wxEmptyString
,
49 long style
= wxTextEntryDialogStyle
,
50 const wxPoint
& pos
= wxDefaultPosition
)
52 Create(parent
, message
, caption
, value
, style
, pos
);
55 bool Create(wxWindow
*parent
,
56 const wxString
& message
,
57 const wxString
& caption
= wxGetTextFromUserPromptStr
,
58 const wxString
& value
= wxEmptyString
,
59 long style
= wxTextEntryDialogStyle
,
60 const wxPoint
& pos
= wxDefaultPosition
);
62 void SetValue(const wxString
& val
);
63 wxString
GetValue() const { return m_value
; }
65 void SetMaxLength(unsigned long len
);
68 void SetTextValidator( const wxTextValidator
& validator
);
69 #if WXWIN_COMPATIBILITY_2_8
70 wxDEPRECATED( void SetTextValidator( long style
) );
72 void SetTextValidator( wxTextValidatorStyle style
= wxFILTER_NONE
);
73 wxTextValidator
* GetTextValidator() { return (wxTextValidator
*)m_textctrl
->GetValidator(); }
74 #endif // wxUSE_VALIDATORS
76 virtual bool TransferDataToWindow();
77 virtual bool TransferDataFromWindow();
79 // implementation only
80 void OnOK(wxCommandEvent
& event
);
83 wxTextCtrl
*m_textctrl
;
89 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog
)
90 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog
);
93 // ----------------------------------------------------------------------------
94 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
95 // ----------------------------------------------------------------------------
97 class WXDLLIMPEXP_CORE wxPasswordEntryDialog
: public wxTextEntryDialog
100 wxPasswordEntryDialog(wxWindow
*parent
,
101 const wxString
& message
,
102 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
103 const wxString
& value
= wxEmptyString
,
104 long style
= wxTextEntryDialogStyle
,
105 const wxPoint
& pos
= wxDefaultPosition
);
107 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog
)
108 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog
);
111 // ----------------------------------------------------------------------------
112 // function to get a string from user
113 // ----------------------------------------------------------------------------
115 WXDLLIMPEXP_CORE wxString
116 wxGetTextFromUser(const wxString
& message
,
117 const wxString
& caption
= wxGetTextFromUserPromptStr
,
118 const wxString
& default_value
= wxEmptyString
,
119 wxWindow
*parent
= NULL
,
120 wxCoord x
= wxDefaultCoord
,
121 wxCoord y
= wxDefaultCoord
,
124 WXDLLIMPEXP_CORE wxString
125 wxGetPasswordFromUser(const wxString
& message
,
126 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
127 const wxString
& default_value
= wxEmptyString
,
128 wxWindow
*parent
= NULL
,
129 wxCoord x
= wxDefaultCoord
,
130 wxCoord y
= wxDefaultCoord
,
135 #endif // _WX_TEXTDLGG_H_