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