]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/generic/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 | |
53a2db12 FM |
28 | extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[]; |
29 | extern WXDLLIMPEXP_DATA_CORE(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 | ||
53a2db12 | 37 | class WXDLLIMPEXP_CORE 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 ); |
40ae9600 FM |
52 | #if WXWIN_COMPATIBILITY_2_8 |
53 | wxDEPRECATED( void SetTextValidator( long style ) ); | |
54 | #endif | |
55 | void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE ); | |
fc0d5b6b JS |
56 | wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } |
57 | #endif | |
58 | // wxUSE_VALIDATORS | |
59 | ||
c50f1fb9 | 60 | // implementation only |
c801d85f KB |
61 | void OnOK(wxCommandEvent& event); |
62 | ||
c50f1fb9 VZ |
63 | protected: |
64 | wxTextCtrl *m_textctrl; | |
65 | wxString m_value; | |
479cd5de | 66 | long m_dialogStyle; |
c50f1fb9 VZ |
67 | |
68 | private: | |
69 | DECLARE_EVENT_TABLE() | |
a294c6d5 | 70 | DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) |
c0c133e1 | 71 | wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog); |
c801d85f KB |
72 | }; |
73 | ||
55b46fd1 KH |
74 | // ---------------------------------------------------------------------------- |
75 | // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] | |
76 | // ---------------------------------------------------------------------------- | |
77 | ||
53a2db12 | 78 | class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog |
55b46fd1 KH |
79 | { |
80 | public: | |
81 | wxPasswordEntryDialog(wxWindow *parent, | |
82 | const wxString& message, | |
83 | const wxString& caption = wxGetPasswordFromUserPromptStr, | |
84 | const wxString& value = wxEmptyString, | |
85 | long style = wxTextEntryDialogStyle, | |
86 | const wxPoint& pos = wxDefaultPosition); | |
87 | private: | |
88 | DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) | |
c0c133e1 | 89 | wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog); |
55b46fd1 KH |
90 | }; |
91 | ||
c49245f8 | 92 | // ---------------------------------------------------------------------------- |
31528cd3 | 93 | // function to get a string from user |
c49245f8 VZ |
94 | // ---------------------------------------------------------------------------- |
95 | ||
53a2db12 FM |
96 | WXDLLIMPEXP_CORE wxString |
97 | wxGetTextFromUser(const wxString& message, | |
98 | const wxString& caption = wxGetTextFromUserPromptStr, | |
99 | const wxString& default_value = wxEmptyString, | |
d3b9f782 | 100 | wxWindow *parent = NULL, |
53a2db12 FM |
101 | wxCoord x = wxDefaultCoord, |
102 | wxCoord y = wxDefaultCoord, | |
103 | bool centre = true); | |
104 | ||
105 | WXDLLIMPEXP_CORE wxString | |
106 | wxGetPasswordFromUser(const wxString& message, | |
107 | const wxString& caption = wxGetPasswordFromUserPromptStr, | |
108 | const wxString& default_value = wxEmptyString, | |
d3b9f782 | 109 | wxWindow *parent = NULL, |
53a2db12 FM |
110 | wxCoord x = wxDefaultCoord, |
111 | wxCoord y = wxDefaultCoord, | |
112 | bool centre = true); | |
a294c6d5 | 113 | |
d7260478 JS |
114 | #endif |
115 | // wxUSE_TEXTDLG | |
92646f5a | 116 | #endif // _WX_TEXTDLGG_H_ |