]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/textdlgg.h
remove unused variable assignment, closes #14928
[wxWidgets.git] / include / wx / generic / textdlgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/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 _WX_TEXTDLGG_H_
13 #define _WX_TEXTDLGG_H_
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 #include "wx/textctrl.h"
24 #endif
25
26 class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
27
28 extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[];
29 extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[];
30
31 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
32
33 // ----------------------------------------------------------------------------
34 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
35 // ----------------------------------------------------------------------------
36
37 class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog
38 {
39 public:
40 wxTextEntryDialog()
41 {
42 m_textctrl = NULL;
43 }
44
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)
51 {
52 Create(parent, message, caption, value, style, pos);
53 }
54
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);
61
62 void SetValue(const wxString& val);
63 wxString GetValue() const { return m_value; }
64
65 #if wxUSE_VALIDATORS
66 void SetTextValidator( const wxTextValidator& validator );
67 #if WXWIN_COMPATIBILITY_2_8
68 wxDEPRECATED( void SetTextValidator( long style ) );
69 #endif
70 void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE );
71 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
72 #endif
73 // wxUSE_VALIDATORS
74
75 // implementation only
76 void OnOK(wxCommandEvent& event);
77
78 protected:
79 wxTextCtrl *m_textctrl;
80 wxString m_value;
81 long m_dialogStyle;
82
83 private:
84 DECLARE_EVENT_TABLE()
85 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
86 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog);
87 };
88
89 // ----------------------------------------------------------------------------
90 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
91 // ----------------------------------------------------------------------------
92
93 class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog
94 {
95 public:
96 wxPasswordEntryDialog(wxWindow *parent,
97 const wxString& message,
98 const wxString& caption = wxGetPasswordFromUserPromptStr,
99 const wxString& value = wxEmptyString,
100 long style = wxTextEntryDialogStyle,
101 const wxPoint& pos = wxDefaultPosition);
102 private:
103 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
104 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog);
105 };
106
107 // ----------------------------------------------------------------------------
108 // function to get a string from user
109 // ----------------------------------------------------------------------------
110
111 WXDLLIMPEXP_CORE wxString
112 wxGetTextFromUser(const wxString& message,
113 const wxString& caption = wxGetTextFromUserPromptStr,
114 const wxString& default_value = wxEmptyString,
115 wxWindow *parent = NULL,
116 wxCoord x = wxDefaultCoord,
117 wxCoord y = wxDefaultCoord,
118 bool centre = true);
119
120 WXDLLIMPEXP_CORE wxString
121 wxGetPasswordFromUser(const wxString& message,
122 const wxString& caption = wxGetPasswordFromUserPromptStr,
123 const wxString& default_value = wxEmptyString,
124 wxWindow *parent = NULL,
125 wxCoord x = wxDefaultCoord,
126 wxCoord y = wxDefaultCoord,
127 bool centre = true);
128
129 #endif
130 // wxUSE_TEXTDLG
131 #endif // _WX_TEXTDLGG_H_