]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/textdlgg.h
added ping location for IRIX
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "textdlgg.h"
17 #endif
18
19 #include "wx/defs.h"
20
21 #if wxUSE_TEXTDLG
22
23 #include "wx/dialog.h"
24
25 #if wxUSE_VALIDATORS
26 #include "wx/valtext.h"
27 #endif
28
29 class WXDLLEXPORT wxTextCtrl;
30
31 extern WXDLLEXPORT_DATA(const wxChar*) wxGetTextFromUserPromptStr;
32 extern WXDLLEXPORT_DATA(const wxChar*) wxGetPasswordFromUserPromptStr;
33
34 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
35
36 // ----------------------------------------------------------------------------
37 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
38 // ----------------------------------------------------------------------------
39
40 class WXDLLEXPORT wxTextEntryDialog : public wxDialog
41 {
42 public:
43 wxTextEntryDialog(wxWindow *parent,
44 const wxString& message,
45 const wxString& caption = wxGetTextFromUserPromptStr,
46 const wxString& value = wxEmptyString,
47 long style = wxTextEntryDialogStyle,
48 const wxPoint& pos = wxDefaultPosition);
49
50 void SetValue(const wxString& val);
51 wxString GetValue() const { return m_value; }
52
53 #if wxUSE_VALIDATORS
54 void SetTextValidator( wxTextValidator& validator );
55 void SetTextValidator( long style = wxFILTER_NONE );
56 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
57 #endif
58 // wxUSE_VALIDATORS
59
60 // implementation only
61 void OnOK(wxCommandEvent& event);
62
63 protected:
64 wxTextCtrl *m_textctrl;
65 wxString m_value;
66 long m_dialogStyle;
67
68 private:
69 DECLARE_EVENT_TABLE()
70 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
71 DECLARE_NO_COPY_CLASS(wxTextEntryDialog)
72 };
73
74 // ----------------------------------------------------------------------------
75 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
76 // ----------------------------------------------------------------------------
77
78 class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog
79 {
80 public:
81 wxPasswordEntryDialog(wxWindow *parent,
82 const wxString& message,
83 const wxString& caption = wxGetPasswordFromUserPromptStr,
84 const wxString& value = wxEmptyString,
85 long style = wxTextEntryDialogStyle,
86 const wxPoint& pos = wxDefaultPosition);
87 private:
88 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
89 DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog)
90 };
91
92 // ----------------------------------------------------------------------------
93 // function to get a string from user
94 // ----------------------------------------------------------------------------
95
96 wxString WXDLLEXPORT
97 wxGetTextFromUser(const wxString& message,
98 const wxString& caption = wxGetTextFromUserPromptStr,
99 const wxString& default_value = wxEmptyString,
100 wxWindow *parent = (wxWindow *) NULL,
101 wxCoord x = wxDefaultCoord,
102 wxCoord y = wxDefaultCoord,
103 bool centre = true);
104
105 wxString WXDLLEXPORT
106 wxGetPasswordFromUser(const wxString& message,
107 const wxString& caption = wxGetPasswordFromUserPromptStr,
108 const wxString& default_value = wxEmptyString,
109 wxWindow *parent = (wxWindow *) NULL,
110 wxCoord x = wxDefaultCoord,
111 wxCoord y = wxDefaultCoord,
112 bool centre = true);
113
114 #endif
115 // wxUSE_TEXTDLG
116 #endif
117 // __TEXTDLGH_G__