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
; }
66 void SetTextValidator( const wxTextValidator
& validator
);
67 #if WXWIN_COMPATIBILITY_2_8
68 wxDEPRECATED( void SetTextValidator( long style
) );
70 void SetTextValidator( wxTextValidatorStyle style
= wxFILTER_NONE
);
71 wxTextValidator
* GetTextValidator() { return (wxTextValidator
*)m_textctrl
->GetValidator(); }
72 #endif // wxUSE_VALIDATORS
74 virtual bool TransferDataToWindow();
75 virtual bool TransferDataFromWindow();
77 // implementation only
78 void OnOK(wxCommandEvent
& event
);
81 wxTextCtrl
*m_textctrl
;
87 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog
)
88 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog
);
91 // ----------------------------------------------------------------------------
92 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
93 // ----------------------------------------------------------------------------
95 class WXDLLIMPEXP_CORE wxPasswordEntryDialog
: public wxTextEntryDialog
98 wxPasswordEntryDialog(wxWindow
*parent
,
99 const wxString
& message
,
100 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
101 const wxString
& value
= wxEmptyString
,
102 long style
= wxTextEntryDialogStyle
,
103 const wxPoint
& pos
= wxDefaultPosition
);
105 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog
)
106 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog
);
109 // ----------------------------------------------------------------------------
110 // function to get a string from user
111 // ----------------------------------------------------------------------------
113 WXDLLIMPEXP_CORE wxString
114 wxGetTextFromUser(const wxString
& message
,
115 const wxString
& caption
= wxGetTextFromUserPromptStr
,
116 const wxString
& default_value
= wxEmptyString
,
117 wxWindow
*parent
= NULL
,
118 wxCoord x
= wxDefaultCoord
,
119 wxCoord y
= wxDefaultCoord
,
122 WXDLLIMPEXP_CORE wxString
123 wxGetPasswordFromUser(const wxString
& message
,
124 const wxString
& caption
= wxGetPasswordFromUserPromptStr
,
125 const wxString
& default_value
= wxEmptyString
,
126 wxWindow
*parent
= NULL
,
127 wxCoord x
= wxDefaultCoord
,
128 wxCoord y
= wxDefaultCoord
,
133 #endif // _WX_TEXTDLGG_H_