]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/textdlgg.h
set eol-style
[wxWidgets.git] / include / wx / generic / textdlgg.h
... / ...
CommitLineData
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 __TEXTDLGH_G__
13#define __TEXTDLGH_G__
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#endif
24
25class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
26
27extern WXDLLEXPORT_DATA(const wxChar) wxGetTextFromUserPromptStr[];
28extern WXDLLEXPORT_DATA(const wxChar) 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
36class WXDLLEXPORT wxTextEntryDialog : public wxDialog
37{
38public:
39 wxTextEntryDialog(wxWindow *parent,
40 const wxString& message,
41 const wxString& caption = wxGetTextFromUserPromptStr,
42 const wxString& value = wxEmptyString,
43 long style = wxTextEntryDialogStyle,
44 const wxPoint& pos = wxDefaultPosition);
45
46 void SetValue(const wxString& val);
47 wxString GetValue() const { return m_value; }
48
49#if wxUSE_VALIDATORS
50 void SetTextValidator( const wxTextValidator& validator );
51 void SetTextValidator( long style = wxFILTER_NONE );
52 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
53#endif
54 // wxUSE_VALIDATORS
55
56 // implementation only
57 void OnOK(wxCommandEvent& event);
58
59protected:
60 wxTextCtrl *m_textctrl;
61 wxString m_value;
62 long m_dialogStyle;
63
64private:
65 DECLARE_EVENT_TABLE()
66 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
67 DECLARE_NO_COPY_CLASS(wxTextEntryDialog)
68};
69
70// ----------------------------------------------------------------------------
71// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
72// ----------------------------------------------------------------------------
73
74class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog
75{
76public:
77 wxPasswordEntryDialog(wxWindow *parent,
78 const wxString& message,
79 const wxString& caption = wxGetPasswordFromUserPromptStr,
80 const wxString& value = wxEmptyString,
81 long style = wxTextEntryDialogStyle,
82 const wxPoint& pos = wxDefaultPosition);
83private:
84 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
85 DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog)
86};
87
88// ----------------------------------------------------------------------------
89// function to get a string from user
90// ----------------------------------------------------------------------------
91
92wxString WXDLLEXPORT
93wxGetTextFromUser(const wxString& message,
94 const wxString& caption = wxGetTextFromUserPromptStr,
95 const wxString& default_value = wxEmptyString,
96 wxWindow *parent = (wxWindow *) NULL,
97 wxCoord x = wxDefaultCoord,
98 wxCoord y = wxDefaultCoord,
99 bool centre = true);
100
101wxString WXDLLEXPORT
102wxGetPasswordFromUser(const wxString& message,
103 const wxString& caption = wxGetPasswordFromUserPromptStr,
104 const wxString& default_value = wxEmptyString,
105 wxWindow *parent = (wxWindow *) NULL,
106 wxCoord x = wxDefaultCoord,
107 wxCoord y = wxDefaultCoord,
108 bool centre = true);
109
110#endif
111 // wxUSE_TEXTDLG
112#endif
113 // __TEXTDLGH_G__