]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/textdlgg.h
Standardize on using "Added" instead of "Add" in the change log.
[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
7// RCS-ID: $Id$
371a5b4e 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
92646f5a
PC
12#ifndef _WX_TEXTDLGG_H_
13#define _WX_TEXTDLGG_H_
c801d85f 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"
92646f5a 23#include "wx/textctrl.h"
fc0d5b6b
JS
24#endif
25
b5dbe15d 26class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
dfe1eee3 27
53a2db12
FM
28extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[];
29extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[];
c801d85f 30
fc0d5b6b 31#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
a294c6d5
VZ
32
33// ----------------------------------------------------------------------------
34// wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
35// ----------------------------------------------------------------------------
36
53a2db12 37class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog
c801d85f 38{
c801d85f 39public:
b8d6be7f
VZ
40 wxTextEntryDialog()
41 {
42 m_textctrl = NULL;
43 }
44
c50f1fb9
VZ
45 wxTextEntryDialog(wxWindow *parent,
46 const wxString& message,
47 const wxString& caption = wxGetTextFromUserPromptStr,
48 const wxString& value = wxEmptyString,
a294c6d5 49 long style = wxTextEntryDialogStyle,
b8d6be7f
VZ
50 const wxPoint& pos = wxDefaultPosition)
51 {
52 Create(parent, message, caption, value, style, pos);
53 }
54
55 bool Create(wxWindow *parent,
56 const wxString& message,
57 const wxString& caption = wxGetTextFromUserPromptStr,
58 const wxString& value = wxEmptyString,
59 long style = wxTextEntryDialogStyle,
60 const wxPoint& pos = wxDefaultPosition);
c801d85f 61
a8f6ef51 62 void SetValue(const wxString& val);
c50f1fb9 63 wxString GetValue() const { return m_value; }
c801d85f 64
fc0d5b6b 65#if wxUSE_VALIDATORS
fbfb8bcc 66 void SetTextValidator( const wxTextValidator& validator );
40ae9600
FM
67#if WXWIN_COMPATIBILITY_2_8
68 wxDEPRECATED( void SetTextValidator( long style ) );
69#endif
70 void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE );
fc0d5b6b 71 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
42fe16e5
VZ
72#endif // wxUSE_VALIDATORS
73
74 virtual bool TransferDataToWindow();
75 virtual bool TransferDataFromWindow();
fc0d5b6b 76
c50f1fb9 77 // implementation only
c801d85f
KB
78 void OnOK(wxCommandEvent& event);
79
c50f1fb9
VZ
80protected:
81 wxTextCtrl *m_textctrl;
82 wxString m_value;
479cd5de 83 long m_dialogStyle;
c50f1fb9
VZ
84
85private:
86 DECLARE_EVENT_TABLE()
a294c6d5 87 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
c0c133e1 88 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog);
c801d85f
KB
89};
90
55b46fd1
KH
91// ----------------------------------------------------------------------------
92// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
93// ----------------------------------------------------------------------------
94
53a2db12 95class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog
55b46fd1
KH
96{
97public:
98 wxPasswordEntryDialog(wxWindow *parent,
99 const wxString& message,
100 const wxString& caption = wxGetPasswordFromUserPromptStr,
101 const wxString& value = wxEmptyString,
102 long style = wxTextEntryDialogStyle,
103 const wxPoint& pos = wxDefaultPosition);
104private:
105 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
c0c133e1 106 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog);
55b46fd1
KH
107};
108
c49245f8 109// ----------------------------------------------------------------------------
31528cd3 110// function to get a string from user
c49245f8
VZ
111// ----------------------------------------------------------------------------
112
53a2db12
FM
113WXDLLIMPEXP_CORE wxString
114 wxGetTextFromUser(const wxString& message,
115 const wxString& caption = wxGetTextFromUserPromptStr,
116 const wxString& default_value = wxEmptyString,
d3b9f782 117 wxWindow *parent = NULL,
53a2db12
FM
118 wxCoord x = wxDefaultCoord,
119 wxCoord y = wxDefaultCoord,
120 bool centre = true);
121
122WXDLLIMPEXP_CORE wxString
123 wxGetPasswordFromUser(const wxString& message,
124 const wxString& caption = wxGetPasswordFromUserPromptStr,
125 const wxString& default_value = wxEmptyString,
d3b9f782 126 wxWindow *parent = NULL,
53a2db12
FM
127 wxCoord x = wxDefaultCoord,
128 wxCoord y = wxDefaultCoord,
129 bool centre = true);
a294c6d5 130
d7260478
JS
131#endif
132 // wxUSE_TEXTDLG
92646f5a 133#endif // _WX_TEXTDLGG_H_