]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/textdlgg.h
added wx_truncate_cast and use it (sometimes instead of wx_static_cast) to explicitel...
[wxWidgets.git] / include / wx / generic / textdlgg.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: 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
12#ifndef __TEXTDLGH_G__
13#define __TEXTDLGH_G__
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
c50f1fb9 16 #pragma interface "textdlgg.h"
c801d85f
KB
17#endif
18
c50f1fb9
VZ
19#include "wx/defs.h"
20
d248a65c
VZ
21#if wxUSE_TEXTDLG
22
c801d85f
KB
23#include "wx/dialog.h"
24
fc0d5b6b
JS
25#if wxUSE_VALIDATORS
26#include "wx/valtext.h"
27#endif
28
dfe1eee3
VZ
29class WXDLLEXPORT wxTextCtrl;
30
f4fffffc
WS
31extern WXDLLEXPORT_DATA(const wxChar*) wxGetTextFromUserPromptStr;
32extern WXDLLEXPORT_DATA(const wxChar*) wxGetPasswordFromUserPromptStr;
c801d85f 33
fc0d5b6b 34#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
a294c6d5
VZ
35
36// ----------------------------------------------------------------------------
37// wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
38// ----------------------------------------------------------------------------
39
c50f1fb9 40class WXDLLEXPORT wxTextEntryDialog : public wxDialog
c801d85f 41{
c801d85f 42public:
c50f1fb9
VZ
43 wxTextEntryDialog(wxWindow *parent,
44 const wxString& message,
45 const wxString& caption = wxGetTextFromUserPromptStr,
46 const wxString& value = wxEmptyString,
a294c6d5 47 long style = wxTextEntryDialogStyle,
c50f1fb9 48 const wxPoint& pos = wxDefaultPosition);
c801d85f 49
a8f6ef51 50 void SetValue(const wxString& val);
c50f1fb9 51 wxString GetValue() const { return m_value; }
c801d85f 52
fc0d5b6b
JS
53#if wxUSE_VALIDATORS
54 void SetTextValidator( wxTextValidator& validator );
55 void SetTextValidator( long style = wxFILTER_NONE );
56 wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
57#endif
58 // wxUSE_VALIDATORS
59
c50f1fb9 60 // implementation only
c801d85f
KB
61 void OnOK(wxCommandEvent& event);
62
c50f1fb9
VZ
63protected:
64 wxTextCtrl *m_textctrl;
65 wxString m_value;
479cd5de 66 long m_dialogStyle;
c50f1fb9
VZ
67
68private:
69 DECLARE_EVENT_TABLE()
a294c6d5 70 DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
22f3361e 71 DECLARE_NO_COPY_CLASS(wxTextEntryDialog)
c801d85f
KB
72};
73
55b46fd1
KH
74// ----------------------------------------------------------------------------
75// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
76// ----------------------------------------------------------------------------
77
78class WXDLLEXPORT wxPasswordEntryDialog : public wxTextEntryDialog
79{
80public:
81 wxPasswordEntryDialog(wxWindow *parent,
82 const wxString& message,
83 const wxString& caption = wxGetPasswordFromUserPromptStr,
84 const wxString& value = wxEmptyString,
85 long style = wxTextEntryDialogStyle,
86 const wxPoint& pos = wxDefaultPosition);
87private:
88 DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
89 DECLARE_NO_COPY_CLASS(wxPasswordEntryDialog)
90};
91
c49245f8 92// ----------------------------------------------------------------------------
31528cd3 93// function to get a string from user
c49245f8
VZ
94// ----------------------------------------------------------------------------
95
c50f1fb9
VZ
96wxString WXDLLEXPORT
97wxGetTextFromUser(const wxString& message,
98 const wxString& caption = wxGetTextFromUserPromptStr,
99 const wxString& default_value = wxEmptyString,
100 wxWindow *parent = (wxWindow *) NULL,
13d13a9e
WS
101 wxCoord x = wxDefaultCoord,
102 wxCoord y = wxDefaultCoord,
ca65c044 103 bool centre = true);
c801d85f 104
a294c6d5
VZ
105wxString WXDLLEXPORT
106wxGetPasswordFromUser(const wxString& message,
55b46fd1 107 const wxString& caption = wxGetPasswordFromUserPromptStr,
a294c6d5 108 const wxString& default_value = wxEmptyString,
b3bb2a74
KH
109 wxWindow *parent = (wxWindow *) NULL,
110 wxCoord x = wxDefaultCoord,
111 wxCoord y = wxDefaultCoord,
112 bool centre = true);
a294c6d5 113
d7260478
JS
114#endif
115 // wxUSE_TEXTDLG
c801d85f
KB
116#endif
117 // __TEXTDLGH_G__