]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/textdlgg.h
Use RIAA wrapper for wxSpinCtrl event disabling in wxGTK.
[wxWidgets.git] / include / wx / generic / textdlgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/textdlgg.h
3 // Purpose: wxTextEntryDialog class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_TEXTDLGG_H_
12 #define _WX_TEXTDLGG_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_TEXTDLG
17
18 #include "wx/dialog.h"
19
20 #if wxUSE_VALIDATORS
21 #include "wx/valtext.h"
22 #include "wx/textctrl.h"
23 #endif
24
25 class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
26
27 extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[];
28 extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[];
29
30 #define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
31
32 // ----------------------------------------------------------------------------
33 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
34 // ----------------------------------------------------------------------------
35
36 class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog
37 {
38 public:
39 wxTextEntryDialog()
40 {
41 m_textctrl = NULL;
42 }
43
44 wxTextEntryDialog(wxWindow *parent,
45 const wxString& message,
46 const wxString& caption = wxGetTextFromUserPromptStr,
47 const wxString& value = wxEmptyString,
48 long style = wxTextEntryDialogStyle,
49 const wxPoint& pos = wxDefaultPosition)
50 {
51 Create(parent, message, caption, value, style, pos);
52 }
53
54 bool Create(wxWindow *parent,
55 const wxString& message,
56 const wxString& caption = wxGetTextFromUserPromptStr,
57 const wxString& value = wxEmptyString,
58 long style = wxTextEntryDialogStyle,
59 const wxPoint& pos = wxDefaultPosition);
60
61 void SetValue(const wxString& val);
62 wxString GetValue() const { return m_value; }
63
64 void SetMaxLength(unsigned long len);
65
66 #if wxUSE_VALIDATORS
67 void SetTextValidator( const wxTextValidator& validator );
68 #if WXWIN_COMPATIBILITY_2_8
69 wxDEPRECATED( void SetTextValidator( long style ) );
70 #endif
71 void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE );
72 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
73 #endif // wxUSE_VALIDATORS
74
75 virtual bool TransferDataToWindow();
76 virtual bool TransferDataFromWindow();
77
78 // implementation only
79 void OnOK(wxCommandEvent& event);
80
81 protected:
82 wxTextCtrl *m_textctrl;
83 wxString m_value;
84 long m_dialogStyle;
85
86 private:
87 DECLARE_EVENT_TABLE()
88 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
89 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog);
90 };
91
92 // ----------------------------------------------------------------------------
93 // wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
94 // ----------------------------------------------------------------------------
95
96 class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog
97 {
98 public:
99 wxPasswordEntryDialog(wxWindow *parent,
100 const wxString& message,
101 const wxString& caption = wxGetPasswordFromUserPromptStr,
102 const wxString& value = wxEmptyString,
103 long style = wxTextEntryDialogStyle,
104 const wxPoint& pos = wxDefaultPosition);
105 private:
106 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
107 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog);
108 };
109
110 // ----------------------------------------------------------------------------
111 // function to get a string from user
112 // ----------------------------------------------------------------------------
113
114 WXDLLIMPEXP_CORE wxString
115 wxGetTextFromUser(const wxString& message,
116 const wxString& caption = wxGetTextFromUserPromptStr,
117 const wxString& default_value = wxEmptyString,
118 wxWindow *parent = NULL,
119 wxCoord x = wxDefaultCoord,
120 wxCoord y = wxDefaultCoord,
121 bool centre = true);
122
123 WXDLLIMPEXP_CORE wxString
124 wxGetPasswordFromUser(const wxString& message,
125 const wxString& caption = wxGetPasswordFromUserPromptStr,
126 const wxString& default_value = wxEmptyString,
127 wxWindow *parent = NULL,
128 wxCoord x = wxDefaultCoord,
129 wxCoord y = wxDefaultCoord,
130 bool centre = true);
131
132 #endif
133 // wxUSE_TEXTDLG
134 #endif // _WX_TEXTDLGG_H_