]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/textdlgg.h
Applied patch [ 565012 ] Add wxTextValidator to wxTextEntryDialog
[wxWidgets.git] / include / wx / generic / textdlgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textdlgg.h
3 // Purpose: wxStatusBar class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __TEXTDLGH_G__
13 #define __TEXTDLGH_G__
14
15 #ifdef __GNUG__
16 #pragma interface "textdlgg.h"
17 #endif
18
19 #include "wx/defs.h"
20
21 #include "wx/dialog.h"
22
23 #if wxUSE_VALIDATORS
24 #include "wx/valtext.h"
25 #endif
26
27 class WXDLLEXPORT wxTextCtrl;
28
29 WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr;
30 WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
31
32 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
33
34 // ----------------------------------------------------------------------------
35 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
36 // ----------------------------------------------------------------------------
37
38 class WXDLLEXPORT wxTextEntryDialog : public wxDialog
39 {
40 public:
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);
47
48 void SetValue(const wxString& val);
49 wxString GetValue() const { return m_value; }
50
51 #if wxUSE_VALIDATORS
52 void SetTextValidator( wxTextValidator& validator );
53 void SetTextValidator( long style = wxFILTER_NONE );
54 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
55 #endif
56 // wxUSE_VALIDATORS
57
58 // implementation only
59 void OnOK(wxCommandEvent& event);
60
61 protected:
62 wxTextCtrl *m_textctrl;
63 wxString m_value;
64 long m_dialogStyle;
65
66 private:
67 DECLARE_EVENT_TABLE()
68 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
69 };
70
71 // ----------------------------------------------------------------------------
72 // function to get a string from user
73 // ----------------------------------------------------------------------------
74
75 wxString WXDLLEXPORT
76 wxGetTextFromUser(const wxString& message,
77 const wxString& caption = wxGetTextFromUserPromptStr,
78 const wxString& default_value = wxEmptyString,
79 wxWindow *parent = (wxWindow *) NULL,
80 int x = -1,
81 int y = -1,
82 bool centre = TRUE);
83
84 wxString WXDLLEXPORT
85 wxGetPasswordFromUser(const wxString& message,
86 const wxString& caption = wxGetTextFromUserPromptStr,
87 const wxString& default_value = wxEmptyString,
88 wxWindow *parent = (wxWindow *) NULL);
89
90 #endif
91 // __TEXTDLGH_G__