Document wxTE_MULTILINE support in wxTextEntryDialog.
[wxWidgets.git] / interface / wx / textdlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textdlg.h
3 // Purpose: interface of wxPasswordEntryDialog
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxPasswordEntryDialog
11
12 This class represents a dialog that requests a one-line password string from
13 the user.
14
15 It is implemented as a generic wxWidgets dialog.
16
17 @library{wxcore}
18 @category{cmndlg}
19
20 @see @ref overview_cmndlg_password
21 */
22 class wxPasswordEntryDialog : public wxTextEntryDialog
23 {
24 public:
25 /**
26 Constructor.
27
28 Use wxTextEntryDialog::ShowModal to show the dialog.
29
30 @param parent
31 Parent window.
32 @param message
33 Message to show on the dialog.
34 @param caption
35 The caption of the dialog.
36 @param defaultValue
37 The default value, which may be the empty string.
38 @param style
39 A dialog style, specifying the buttons (wxOK, wxCANCEL) and an
40 optional wxCENTRE style. You do not need to specify the wxTE_PASSWORD style,
41 it is always applied.
42 @param pos
43 Dialog position.
44 */
45 wxPasswordEntryDialog(wxWindow* parent, const wxString& message,
46 const wxString& caption = wxGetPasswordFromUserPromptStr,
47 const wxString& defaultValue = wxEmptyString,
48 long style = wxOK | wxCANCEL | wxCENTRE,
49 const wxPoint& pos = wxDefaultPosition);
50 };
51
52
53
54 /**
55 @class wxTextEntryDialog
56
57 This class represents a dialog that requests a one-line text string from the user.
58 It is implemented as a generic wxWidgets dialog.
59
60 @library{wxcore}
61 @category{cmndlg}
62
63 @see @ref overview_cmndlg_textentry
64 */
65 class wxTextEntryDialog : public wxDialog
66 {
67 public:
68 /**
69 Constructor. Use ShowModal() to show the dialog.
70
71 @param parent
72 Parent window.
73 @param message
74 Message to show on the dialog.
75 @param caption
76 The caption of the the dialog.
77 @param value
78 The default value, which may be the empty string.
79 @param style
80 A dialog style, specifying the buttons (wxOK, wxCANCEL)
81 and an optional wxCENTRE style. Additionally, wxTextCtrl styles
82 (such as @c wxTE_PASSWORD or @c wxTE_MULTILINE) may be specified
83 here.
84 @param pos
85 Dialog position.
86 */
87 wxTextEntryDialog(wxWindow* parent, const wxString& message,
88 const wxString& caption = wxGetTextFromUserPromptStr,
89 const wxString& value = wxEmptyString,
90 long style = wxOK | wxCANCEL | wxCENTRE,
91 const wxPoint& pos = wxDefaultPosition);
92
93 /**
94 Destructor.
95 */
96 virtual ~wxTextEntryDialog();
97
98 /**
99 Returns the text that the user has entered if the user has pressed OK, or the
100 original value if the user has pressed Cancel.
101 */
102 wxString GetValue() const;
103
104 /**
105 Sets the default text value.
106 */
107 void SetValue(const wxString& value);
108
109 /**
110 Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL
111 otherwise.
112 */
113 int ShowModal();
114 };
115
116
117
118 // ============================================================================
119 // Global functions/macros
120 // ============================================================================
121
122 /** @addtogroup group_funcmacro_dialog */
123 //@{
124
125 /**
126 Pop up a dialog box with title set to @e caption, @c message, and a
127 @c default_value. The user may type in text and press OK to return this
128 text, or press Cancel to return the empty string.
129
130 If @c centre is @true, the message text (which may include new line
131 characters) is centred; if @false, the message is left-justified.
132
133 This function is a wrapper around wxTextEntryDialog and while it is usually
134 more convenient to use, using the dialog directly is more flexible, e.g. it
135 allows you to specify the @c wxTE_MULTILINE to allow the user enter
136 multiple lines of text while this function is limited to single line entry
137 only.
138
139 @header{wx/textdlg.h}
140 */
141 wxString wxGetTextFromUser(const wxString& message,
142 const wxString& caption = "Input text",
143 const wxString& default_value = wxEmptyString,
144 wxWindow* parent = NULL,
145 int x = wxDefaultCoord,
146 int y = wxDefaultCoord,
147 bool centre = true);
148
149 /**
150 Similar to wxGetTextFromUser() but the text entered in the dialog is not
151 shown on screen but replaced with stars. This is intended to be used for
152 entering passwords as the function name implies.
153
154 @header{wx/textdlg.h}
155 */
156 wxString wxGetPasswordFromUser(const wxString& message,
157 const wxString& caption = "Input text",
158 const wxString& default_value = wxEmptyString,
159 wxWindow* parent = NULL,
160 int x = wxDefaultCoord,
161 int y = wxDefaultCoord,
162 bool centre = true);
163
164 //@}
165