]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/textdlgg.h
wxRTC: fixed guidelines overwriting adjacent cell borders; corrected capitalisation...
[wxWidgets.git] / include / wx / generic / textdlgg.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/generic/textdlgg.h
fc5414a1 3// Purpose: wxTextEntryDialog class
c801d85f
KB
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
371a5b4e 7// Copyright: (c) Julian Smart
65571936 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
92646f5a
PC
11#ifndef _WX_TEXTDLGG_H_
12#define _WX_TEXTDLGG_H_
c801d85f 13
c50f1fb9
VZ
14#include "wx/defs.h"
15
d248a65c
VZ
16#if wxUSE_TEXTDLG
17
c801d85f
KB
18#include "wx/dialog.h"
19
fc0d5b6b
JS
20#if wxUSE_VALIDATORS
21#include "wx/valtext.h"
92646f5a 22#include "wx/textctrl.h"
fc0d5b6b
JS
23#endif
24
b5dbe15d 25class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
dfe1eee3 26
53a2db12
FM
27extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[];
28extern WXDLLIMPEXP_DATA_CORE(const char) 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
53a2db12 36class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog
c801d85f 37{
c801d85f 38public:
b8d6be7f
VZ
39 wxTextEntryDialog()
40 {
41 m_textctrl = NULL;
42 }
43
c50f1fb9
VZ
44 wxTextEntryDialog(wxWindow *parent,
45 const wxString& message,
46 const wxString& caption = wxGetTextFromUserPromptStr,
47 const wxString& value = wxEmptyString,
a294c6d5 48 long style = wxTextEntryDialogStyle,
b8d6be7f
VZ
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);
c801d85f 60
a8f6ef51 61 void SetValue(const wxString& val);
c50f1fb9 62 wxString GetValue() const { return m_value; }
c801d85f 63
62a58fbe
VZ
64 void SetMaxLength(unsigned long len);
65
fc0d5b6b 66#if wxUSE_VALIDATORS
fbfb8bcc 67 void SetTextValidator( const wxTextValidator& validator );
40ae9600
FM
68#if WXWIN_COMPATIBILITY_2_8
69 wxDEPRECATED( void SetTextValidator( long style ) );
70#endif
71 void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE );
fc0d5b6b 72 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
42fe16e5
VZ
73#endif // wxUSE_VALIDATORS
74
75 virtual bool TransferDataToWindow();
76 virtual bool TransferDataFromWindow();
fc0d5b6b 77
c50f1fb9 78 // implementation only
c801d85f
KB
79 void OnOK(wxCommandEvent& event);
80
c50f1fb9
VZ
81protected:
82 wxTextCtrl *m_textctrl;
83 wxString m_value;
479cd5de 84 long m_dialogStyle;
c50f1fb9
VZ
85
86private:
87 DECLARE_EVENT_TABLE()
a294c6d5 88 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
c0c133e1 89 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog);
c801d85f
KB
90};
91
55b46fd1
KH
92// ----------------------------------------------------------------------------
93// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
94// ----------------------------------------------------------------------------
95
53a2db12 96class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog
55b46fd1
KH
97{
98public:
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);
105private:
106 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
c0c133e1 107 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog);
55b46fd1
KH
108};
109
c49245f8 110// ----------------------------------------------------------------------------
31528cd3 111// function to get a string from user
c49245f8
VZ
112// ----------------------------------------------------------------------------
113
53a2db12
FM
114WXDLLIMPEXP_CORE wxString
115 wxGetTextFromUser(const wxString& message,
116 const wxString& caption = wxGetTextFromUserPromptStr,
117 const wxString& default_value = wxEmptyString,
d3b9f782 118 wxWindow *parent = NULL,
53a2db12
FM
119 wxCoord x = wxDefaultCoord,
120 wxCoord y = wxDefaultCoord,
121 bool centre = true);
122
123WXDLLIMPEXP_CORE wxString
124 wxGetPasswordFromUser(const wxString& message,
125 const wxString& caption = wxGetPasswordFromUserPromptStr,
126 const wxString& default_value = wxEmptyString,
d3b9f782 127 wxWindow *parent = NULL,
53a2db12
FM
128 wxCoord x = wxDefaultCoord,
129 wxCoord y = wxDefaultCoord,
130 bool centre = true);
a294c6d5 131
d7260478
JS
132#endif
133 // wxUSE_TEXTDLG
92646f5a 134#endif // _WX_TEXTDLGG_H_