]>
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 | ||
9 | /** | |
10 | @class wxPasswordEntryDialog | |
7c913512 | 11 | |
23324ae1 FM |
12 | This class represents a dialog that requests a one-line password string from |
13 | the user. | |
c6cf894a | 14 | |
23324ae1 | 15 | It is implemented as a generic wxWidgets dialog. |
7c913512 | 16 | |
a1e62aaa | 17 | @library{wxcore} |
23324ae1 | 18 | @category{cmndlg} |
7c913512 | 19 | |
c6cf894a | 20 | @see @ref overview_cmndlg_password |
23324ae1 FM |
21 | */ |
22 | class wxPasswordEntryDialog : public wxTextEntryDialog | |
23 | { | |
24 | public: | |
c6cf894a FM |
25 | /** |
26 | Constructor. | |
7c913512 | 27 | |
c6cf894a FM |
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. | |
4701dc09 FM |
34 | @param caption |
35 | The caption of the dialog. | |
c6cf894a FM |
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, | |
8067ee11 | 46 | const wxString& caption = wxGetPasswordFromUserPromptStr, |
c6cf894a FM |
47 | const wxString& defaultValue = wxEmptyString, |
48 | long style = wxOK | wxCANCEL | wxCENTRE, | |
49 | const wxPoint& pos = wxDefaultPosition); | |
23324ae1 FM |
50 | }; |
51 | ||
52 | ||
e54c96f1 | 53 | |
23324ae1 FM |
54 | /** |
55 | @class wxTextEntryDialog | |
7c913512 | 56 | |
c6cf894a | 57 | This class represents a dialog that requests a one-line text string from the user. |
23324ae1 | 58 | It is implemented as a generic wxWidgets dialog. |
7c913512 | 59 | |
a1e62aaa | 60 | @library{wxcore} |
23324ae1 | 61 | @category{cmndlg} |
7c913512 | 62 | |
c6cf894a | 63 | @see @ref overview_cmndlg_textentry |
23324ae1 FM |
64 | */ |
65 | class wxTextEntryDialog : public wxDialog | |
66 | { | |
67 | public: | |
68 | /** | |
69 | Constructor. Use ShowModal() to show the dialog. | |
3c4f71cc | 70 | |
7c913512 | 71 | @param parent |
4cc4bfaf | 72 | Parent window. |
7c913512 | 73 | @param message |
4cc4bfaf | 74 | Message to show on the dialog. |
77bfb902 | 75 | @param caption |
4c51a665 | 76 | The caption of the dialog. |
41e69d79 | 77 | @param value |
4cc4bfaf | 78 | The default value, which may be the empty string. |
7c913512 | 79 | @param style |
4cc4bfaf | 80 | A dialog style, specifying the buttons (wxOK, wxCANCEL) |
c6cf894a | 81 | and an optional wxCENTRE style. Additionally, wxTextCtrl styles |
50a2a355 VZ |
82 | (such as @c wxTE_PASSWORD or @c wxTE_MULTILINE) may be specified |
83 | here. | |
7c913512 | 84 | @param pos |
4cc4bfaf | 85 | Dialog position. |
23324ae1 FM |
86 | */ |
87 | wxTextEntryDialog(wxWindow* parent, const wxString& message, | |
8067ee11 FM |
88 | const wxString& caption = wxGetTextFromUserPromptStr, |
89 | const wxString& value = wxEmptyString, | |
4cc4bfaf | 90 | long style = wxOK | wxCANCEL | wxCENTRE, |
23324ae1 FM |
91 | const wxPoint& pos = wxDefaultPosition); |
92 | ||
93 | /** | |
94 | Destructor. | |
95 | */ | |
adaaa686 | 96 | virtual ~wxTextEntryDialog(); |
23324ae1 FM |
97 | |
98 | /** | |
99 | Returns the text that the user has entered if the user has pressed OK, or the | |
c6cf894a | 100 | original value if the user has pressed Cancel. |
23324ae1 | 101 | */ |
328f5751 | 102 | wxString GetValue() const; |
23324ae1 FM |
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 | ||
e54c96f1 | 117 | |
23324ae1 FM |
118 | // ============================================================================ |
119 | // Global functions/macros | |
120 | // ============================================================================ | |
121 | ||
b21126db | 122 | /** @addtogroup group_funcmacro_dialog */ |
ba2874ff BP |
123 | //@{ |
124 | ||
23324ae1 | 125 | /** |
ba2874ff BP |
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 | ||
50a2a355 VZ |
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 | ||
ba2874ff | 139 | @header{wx/textdlg.h} |
23324ae1 FM |
140 | */ |
141 | wxString wxGetTextFromUser(const wxString& message, | |
142 | const wxString& caption = "Input text", | |
e9c3992c | 143 | const wxString& default_value = wxEmptyString, |
4cc4bfaf | 144 | wxWindow* parent = NULL, |
23324ae1 FM |
145 | int x = wxDefaultCoord, |
146 | int y = wxDefaultCoord, | |
4cc4bfaf | 147 | bool centre = true); |
23324ae1 FM |
148 | |
149 | /** | |
ba2874ff BP |
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} | |
23324ae1 FM |
155 | */ |
156 | wxString wxGetPasswordFromUser(const wxString& message, | |
157 | const wxString& caption = "Input text", | |
e9c3992c | 158 | const wxString& default_value = wxEmptyString, |
4cc4bfaf | 159 | wxWindow* parent = NULL, |
23324ae1 FM |
160 | int x = wxDefaultCoord, |
161 | int y = wxDefaultCoord, | |
4cc4bfaf | 162 | bool centre = true); |
23324ae1 | 163 | |
ba2874ff BP |
164 | //@} |
165 |