]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: textdlgg.h | |
fc5414a1 | 3 | // Purpose: wxTextEntryDialog class |
c801d85f KB |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
371a5b4e | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
92646f5a PC |
12 | #ifndef _WX_TEXTDLGG_H_ |
13 | #define _WX_TEXTDLGG_H_ | |
c801d85f | 14 | |
c50f1fb9 VZ |
15 | #include "wx/defs.h" |
16 | ||
d248a65c VZ |
17 | #if wxUSE_TEXTDLG |
18 | ||
c801d85f KB |
19 | #include "wx/dialog.h" |
20 | ||
fc0d5b6b JS |
21 | #if wxUSE_VALIDATORS |
22 | #include "wx/valtext.h" | |
92646f5a | 23 | #include "wx/textctrl.h" |
fc0d5b6b JS |
24 | #endif |
25 | ||
b5dbe15d | 26 | class WXDLLIMPEXP_FWD_CORE wxTextCtrl; |
dfe1eee3 | 27 | |
f36e602b VZ |
28 | extern WXDLLEXPORT_DATA(const char) wxGetTextFromUserPromptStr[]; |
29 | extern WXDLLEXPORT_DATA(const char) wxGetPasswordFromUserPromptStr[]; | |
c801d85f | 30 | |
fc0d5b6b | 31 | #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY) |
a294c6d5 VZ |
32 | |
33 | // ---------------------------------------------------------------------------- | |
34 | // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons | |
35 | // ---------------------------------------------------------------------------- | |
36 | ||
c50f1fb9 | 37 | class WXDLLEXPORT wxTextEntryDialog : public wxDialog |
c801d85f | 38 | { |
c801d85f | 39 | public: |
c50f1fb9 VZ |
40 | wxTextEntryDialog(wxWindow *parent, |
41 | const wxString& message, | |
42 | const wxString& caption = wxGetTextFromUserPromptStr, | |
43 | const wxString& value = wxEmptyString, | |
a294c6d5 | 44 | long style = wxTextEntryDialogStyle, |
c50f1fb9 | 45 | const wxPoint& pos = wxDefaultPosition); |
c801d85f | 46 | |
a8f6ef51 | 47 | void SetValue(const wxString& val); |
c50f1fb9 | 48 | wxString GetValue() const { return m_value; } |
c801d85f | 49 | |
fc0d5b6b | 50 | #if wxUSE_VALIDATORS |
fbfb8bcc | 51 | void SetTextValidator( const wxTextValidator& validator ); |
fc0d5b6b JS |
52 | void SetTextValidator( long style = wxFILTER_NONE ); |
53 | wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } | |
54 | #endif | |
55 | // wxUSE_VALIDATORS | |
56 | ||
c50f1fb9 | 57 | // implementation only |
c801d85f KB |
58 | void OnOK(wxCommandEvent& event); |
59 | ||
c50f1fb9 VZ |
60 | protected: |
61 | wxTextCtrl *m_textctrl; | |
62 | wxString m_value; | |
479cd5de | 63 | long m_dialogStyle; |
c50f1fb9 VZ |
64 | |
65 | private: | |
66 | DECLARE_EVENT_TABLE() | |
a294c6d5 | 67 | DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) |
22f3361e | 68 | DECLARE_NO_COPY_CLASS(wxTextEntryDialog) |
c801d85f KB |
69 | }; |
70 | ||
55b46fd1 KH |
71 | // ---------------------------------------------------------------------------- |
72 | // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] | |
73 | // ---------------------------------------------------------------------------- | |
74 | ||
75 | class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog | |
76 | { | |
77 | public: | |
78 | wxPasswordEntryDialog(wxWindow *parent, | |
79 | const wxString& message, | |
80 | const wxString& caption = wxGetPasswordFromUserPromptStr, | |
81 | const wxString& value = wxEmptyString, | |
82 | long style = wxTextEntryDialogStyle, | |
83 | const wxPoint& pos = wxDefaultPosition); | |
84 | private: | |
85 | DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) | |
86 | DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog) | |
87 | }; | |
88 | ||
c49245f8 | 89 | // ---------------------------------------------------------------------------- |
31528cd3 | 90 | // function to get a string from user |
c49245f8 VZ |
91 | // ---------------------------------------------------------------------------- |
92 | ||
c50f1fb9 VZ |
93 | wxString WXDLLEXPORT |
94 | wxGetTextFromUser(const wxString& message, | |
95 | const wxString& caption = wxGetTextFromUserPromptStr, | |
96 | const wxString& default_value = wxEmptyString, | |
97 | wxWindow *parent = (wxWindow *) NULL, | |
13d13a9e WS |
98 | wxCoord x = wxDefaultCoord, |
99 | wxCoord y = wxDefaultCoord, | |
ca65c044 | 100 | bool centre = true); |
c801d85f | 101 | |
a294c6d5 VZ |
102 | wxString WXDLLEXPORT |
103 | wxGetPasswordFromUser(const wxString& message, | |
55b46fd1 | 104 | const wxString& caption = wxGetPasswordFromUserPromptStr, |
a294c6d5 | 105 | const wxString& default_value = wxEmptyString, |
b3bb2a74 KH |
106 | wxWindow *parent = (wxWindow *) NULL, |
107 | wxCoord x = wxDefaultCoord, | |
108 | wxCoord y = wxDefaultCoord, | |
109 | bool centre = true); | |
a294c6d5 | 110 | |
d7260478 JS |
111 | #endif |
112 | // wxUSE_TEXTDLG | |
92646f5a | 113 | #endif // _WX_TEXTDLGG_H_ |