]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/textdlgg.h
Don't require skipping "page changed" event in wxMSW wxNotebook.
[wxWidgets.git] / include / wx / generic / textdlgg.h
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 #if WXWIN_COMPATIBILITY_2_8
53 wxDEPRECATED( void SetTextValidator( long style ) );
54 #endif
55 void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE );
56 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
57 #endif
58 // wxUSE_VALIDATORS
59
60 // implementation only
61 void OnOK(wxCommandEvent& event);
62
63 protected:
64 wxTextCtrl *m_textctrl;
65 wxString m_value;
66 long m_dialogStyle;
67
68 private:
69 DECLARE_EVENT_TABLE()
70 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
71 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog);
72 };
73
74 // ----------------------------------------------------------------------------
75 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
76 // ----------------------------------------------------------------------------
77
78 class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog
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)
89 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog);
90 };
91
92 // ----------------------------------------------------------------------------
93 // function to get a string from user
94 // ----------------------------------------------------------------------------
95
96 WXDLLIMPEXP_CORE wxString
97 wxGetTextFromUser(const wxString& message,
98 const wxString& caption = wxGetTextFromUserPromptStr,
99 const wxString& default_value = wxEmptyString,
100 wxWindow *parent = NULL,
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,
109 wxWindow *parent = NULL,
110 wxCoord x = wxDefaultCoord,
111 wxCoord y = wxDefaultCoord,
112 bool centre = true);
113
114 #endif
115 // wxUSE_TEXTDLG
116 #endif // _WX_TEXTDLGG_H_