]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/textdlgg.h
Richtext interface fixes and additions for Phoenix
[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
62a58fbe
VZ
65 void SetMaxLength(unsigned long len);
66
fc0d5b6b 67#if wxUSE_VALIDATORS
fbfb8bcc 68 void SetTextValidator( const wxTextValidator& validator );
40ae9600
FM
69#if WXWIN_COMPATIBILITY_2_8
70 wxDEPRECATED( void SetTextValidator( long style ) );
71#endif
72 void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE );
fc0d5b6b 73 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
42fe16e5
VZ
74#endif // wxUSE_VALIDATORS
75
76 virtual bool TransferDataToWindow();
77 virtual bool TransferDataFromWindow();
fc0d5b6b 78
c50f1fb9 79 // implementation only
c801d85f
KB
80 void OnOK(wxCommandEvent& event);
81
c50f1fb9
VZ
82protected:
83 wxTextCtrl *m_textctrl;
84 wxString m_value;
479cd5de 85 long m_dialogStyle;
c50f1fb9
VZ
86
87private:
88 DECLARE_EVENT_TABLE()
a294c6d5 89 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
c0c133e1 90 wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog);
c801d85f
KB
91};
92
55b46fd1
KH
93// ----------------------------------------------------------------------------
94// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
95// ----------------------------------------------------------------------------
96
53a2db12 97class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog
55b46fd1
KH
98{
99public:
100 wxPasswordEntryDialog(wxWindow *parent,
101 const wxString& message,
102 const wxString& caption = wxGetPasswordFromUserPromptStr,
103 const wxString& value = wxEmptyString,
104 long style = wxTextEntryDialogStyle,
105 const wxPoint& pos = wxDefaultPosition);
106private:
107 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
c0c133e1 108 wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog);
55b46fd1
KH
109};
110
c49245f8 111// ----------------------------------------------------------------------------
31528cd3 112// function to get a string from user
c49245f8
VZ
113// ----------------------------------------------------------------------------
114
53a2db12
FM
115WXDLLIMPEXP_CORE wxString
116 wxGetTextFromUser(const wxString& message,
117 const wxString& caption = wxGetTextFromUserPromptStr,
118 const wxString& default_value = wxEmptyString,
d3b9f782 119 wxWindow *parent = NULL,
53a2db12
FM
120 wxCoord x = wxDefaultCoord,
121 wxCoord y = wxDefaultCoord,
122 bool centre = true);
123
124WXDLLIMPEXP_CORE wxString
125 wxGetPasswordFromUser(const wxString& message,
126 const wxString& caption = wxGetPasswordFromUserPromptStr,
127 const wxString& default_value = wxEmptyString,
d3b9f782 128 wxWindow *parent = NULL,
53a2db12
FM
129 wxCoord x = wxDefaultCoord,
130 wxCoord y = wxDefaultCoord,
131 bool centre = true);
a294c6d5 132
d7260478
JS
133#endif
134 // wxUSE_TEXTDLG
92646f5a 135#endif // _WX_TEXTDLGG_H_