]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/textdlgg.h
removed wxHAS_NATIVE_TAB_TRAVERSAL which is now defined in wx/window.h
[wxWidgets.git] / include / wx / generic / textdlgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textdlgg.h
3 // Purpose: wxTextEntryDialog class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __TEXTDLGH_G__
13 #define __TEXTDLGH_G__
14
15 #include "wx/defs.h"
16
17 #if wxUSE_TEXTDLG
18
19 #include "wx/dialog.h"
20
21 #if wxUSE_VALIDATORS
22 #include "wx/valtext.h"
23 #endif
24
25 class WXDLLEXPORT wxTextCtrl;
26
27 extern WXDLLEXPORT_DATA(const wxChar) wxGetTextFromUserPromptStr[];
28 extern WXDLLEXPORT_DATA(const wxChar) wxGetPasswordFromUserPromptStr[];
29
30 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
31
32 // ----------------------------------------------------------------------------
33 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
34 // ----------------------------------------------------------------------------
35
36 class WXDLLEXPORT wxTextEntryDialog : public wxDialog
37 {
38 public:
39 wxTextEntryDialog(wxWindow *parent,
40 const wxString& message,
41 const wxString& caption = wxGetTextFromUserPromptStr,
42 const wxString& value = wxEmptyString,
43 long style = wxTextEntryDialogStyle,
44 const wxPoint& pos = wxDefaultPosition);
45
46 void SetValue(const wxString& val);
47 wxString GetValue() const { return m_value; }
48
49 #if wxUSE_VALIDATORS
50 void SetTextValidator( const wxTextValidator& validator );
51 void SetTextValidator( long style = wxFILTER_NONE );
52 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
53 #endif
54 // wxUSE_VALIDATORS
55
56 // implementation only
57 void OnOK(wxCommandEvent& event);
58
59 protected:
60 wxTextCtrl *m_textctrl;
61 wxString m_value;
62 long m_dialogStyle;
63
64 private:
65 DECLARE_EVENT_TABLE()
66 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
67 DECLARE_NO_COPY_CLASS(wxTextEntryDialog)
68 };
69
70 // ----------------------------------------------------------------------------
71 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
72 // ----------------------------------------------------------------------------
73
74 class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog
75 {
76 public:
77 wxPasswordEntryDialog(wxWindow *parent,
78 const wxString& message,
79 const wxString& caption = wxGetPasswordFromUserPromptStr,
80 const wxString& value = wxEmptyString,
81 long style = wxTextEntryDialogStyle,
82 const wxPoint& pos = wxDefaultPosition);
83 private:
84 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
85 DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog)
86 };
87
88 // ----------------------------------------------------------------------------
89 // function to get a string from user
90 // ----------------------------------------------------------------------------
91
92 wxString WXDLLEXPORT
93 wxGetTextFromUser(const wxString& message,
94 const wxString& caption = wxGetTextFromUserPromptStr,
95 const wxString& default_value = wxEmptyString,
96 wxWindow *parent = (wxWindow *) NULL,
97 wxCoord x = wxDefaultCoord,
98 wxCoord y = wxDefaultCoord,
99 bool centre = true);
100
101 wxString WXDLLEXPORT
102 wxGetPasswordFromUser(const wxString& message,
103 const wxString& caption = wxGetPasswordFromUserPromptStr,
104 const wxString& default_value = wxEmptyString,
105 wxWindow *parent = (wxWindow *) NULL,
106 wxCoord x = wxDefaultCoord,
107 wxCoord y = wxDefaultCoord,
108 bool centre = true);
109
110 #endif
111 // wxUSE_TEXTDLG
112 #endif
113 // __TEXTDLGH_G__