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