]>
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 | ||
12 | #ifndef __TEXTDLGH_G__ | |
13 | #define __TEXTDLGH_G__ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
c50f1fb9 | 16 | #pragma interface "textdlgg.h" |
c801d85f KB |
17 | #endif |
18 | ||
d7260478 | 19 | #if wxUSE_TEXTDLG |
c50f1fb9 VZ |
20 | #include "wx/defs.h" |
21 | ||
c801d85f KB |
22 | #include "wx/dialog.h" |
23 | ||
fc0d5b6b JS |
24 | #if wxUSE_VALIDATORS |
25 | #include "wx/valtext.h" | |
26 | #endif | |
27 | ||
dfe1eee3 VZ |
28 | class WXDLLEXPORT wxTextCtrl; |
29 | ||
9d2f3c71 | 30 | WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr; |
55b46fd1 | 31 | WXDLLEXPORT_DATA(extern const wxChar*) wxGetPasswordFromUserPromptStr; |
c801d85f | 32 | |
fc0d5b6b | 33 | #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY) |
a294c6d5 VZ |
34 | |
35 | // ---------------------------------------------------------------------------- | |
36 | // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons | |
37 | // ---------------------------------------------------------------------------- | |
38 | ||
c50f1fb9 | 39 | class WXDLLEXPORT wxTextEntryDialog : public wxDialog |
c801d85f | 40 | { |
c801d85f | 41 | public: |
c50f1fb9 VZ |
42 | wxTextEntryDialog(wxWindow *parent, |
43 | const wxString& message, | |
44 | const wxString& caption = wxGetTextFromUserPromptStr, | |
45 | const wxString& value = wxEmptyString, | |
a294c6d5 | 46 | long style = wxTextEntryDialogStyle, |
c50f1fb9 | 47 | const wxPoint& pos = wxDefaultPosition); |
c801d85f | 48 | |
a8f6ef51 | 49 | void SetValue(const wxString& val); |
c50f1fb9 | 50 | wxString GetValue() const { return m_value; } |
c801d85f | 51 | |
fc0d5b6b JS |
52 | #if wxUSE_VALIDATORS |
53 | void SetTextValidator( wxTextValidator& validator ); | |
54 | void SetTextValidator( long style = wxFILTER_NONE ); | |
55 | wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } | |
56 | #endif | |
57 | // wxUSE_VALIDATORS | |
58 | ||
c50f1fb9 | 59 | // implementation only |
c801d85f KB |
60 | void OnOK(wxCommandEvent& event); |
61 | ||
c50f1fb9 VZ |
62 | protected: |
63 | wxTextCtrl *m_textctrl; | |
64 | wxString m_value; | |
479cd5de | 65 | long m_dialogStyle; |
c50f1fb9 VZ |
66 | |
67 | private: | |
68 | DECLARE_EVENT_TABLE() | |
a294c6d5 | 69 | DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) |
22f3361e | 70 | DECLARE_NO_COPY_CLASS(wxTextEntryDialog) |
c801d85f KB |
71 | }; |
72 | ||
55b46fd1 KH |
73 | // ---------------------------------------------------------------------------- |
74 | // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] | |
75 | // ---------------------------------------------------------------------------- | |
76 | ||
77 | class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog | |
78 | { | |
79 | public: | |
80 | wxPasswordEntryDialog(wxWindow *parent, | |
81 | const wxString& message, | |
82 | const wxString& caption = wxGetPasswordFromUserPromptStr, | |
83 | const wxString& value = wxEmptyString, | |
84 | long style = wxTextEntryDialogStyle, | |
85 | const wxPoint& pos = wxDefaultPosition); | |
86 | private: | |
87 | DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) | |
88 | DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog) | |
89 | }; | |
90 | ||
c49245f8 | 91 | // ---------------------------------------------------------------------------- |
31528cd3 | 92 | // function to get a string from user |
c49245f8 VZ |
93 | // ---------------------------------------------------------------------------- |
94 | ||
c50f1fb9 VZ |
95 | wxString WXDLLEXPORT |
96 | wxGetTextFromUser(const wxString& message, | |
97 | const wxString& caption = wxGetTextFromUserPromptStr, | |
98 | const wxString& default_value = wxEmptyString, | |
99 | wxWindow *parent = (wxWindow *) NULL, | |
13d13a9e WS |
100 | wxCoord x = wxDefaultCoord, |
101 | wxCoord y = wxDefaultCoord, | |
ca65c044 | 102 | bool centre = true); |
c801d85f | 103 | |
a294c6d5 VZ |
104 | wxString WXDLLEXPORT |
105 | wxGetPasswordFromUser(const wxString& message, | |
55b46fd1 | 106 | const wxString& caption = wxGetPasswordFromUserPromptStr, |
a294c6d5 | 107 | const wxString& default_value = wxEmptyString, |
b3bb2a74 KH |
108 | wxWindow *parent = (wxWindow *) NULL, |
109 | wxCoord x = wxDefaultCoord, | |
110 | wxCoord y = wxDefaultCoord, | |
111 | bool centre = true); | |
a294c6d5 | 112 | |
d7260478 JS |
113 | #endif |
114 | // wxUSE_TEXTDLG | |
c801d85f KB |
115 | #endif |
116 | // __TEXTDLGH_G__ |