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