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 WXDLLEXPORT_DATA(extern const wxChar
*) wxGetTextFromUserPromptStr
;
32 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
34 // ----------------------------------------------------------------------------
35 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
36 // ----------------------------------------------------------------------------
38 class WXDLLEXPORT wxTextEntryDialog
: public wxDialog
41 wxTextEntryDialog(wxWindow
*parent
,
42 const wxString
& message
,
43 const wxString
& caption
= wxGetTextFromUserPromptStr
,
44 const wxString
& value
= wxEmptyString
,
45 long style
= wxTextEntryDialogStyle
,
46 const wxPoint
& pos
= wxDefaultPosition
);
48 void SetValue(const wxString
& val
);
49 wxString
GetValue() const { return m_value
; }
52 void SetTextValidator( wxTextValidator
& validator
);
53 void SetTextValidator( long style
= wxFILTER_NONE
);
54 wxTextValidator
* GetTextValidator() { return (wxTextValidator
*)m_textctrl
->GetValidator(); }
58 // implementation only
59 void OnOK(wxCommandEvent
& event
);
62 wxTextCtrl
*m_textctrl
;
68 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog
)
69 DECLARE_NO_COPY_CLASS(wxTextEntryDialog
)
72 // ----------------------------------------------------------------------------
73 // function to get a string from user
74 // ----------------------------------------------------------------------------
77 wxGetTextFromUser(const wxString
& message
,
78 const wxString
& caption
= wxGetTextFromUserPromptStr
,
79 const wxString
& default_value
= wxEmptyString
,
80 wxWindow
*parent
= (wxWindow
*) NULL
,
81 int x
= wxDefaultPosition
.x
,
82 int y
= wxDefaultPosition
.y
,
86 wxGetPasswordFromUser(const wxString
& message
,
87 const wxString
& caption
= wxGetTextFromUserPromptStr
,
88 const wxString
& default_value
= wxEmptyString
,
89 wxWindow
*parent
= (wxWindow
*) NULL
);