1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-20 00:14:35 +00:00
|
|
|
// Name: wx/generic/textdlgg.h
|
2004-02-07 13:55:49 +00:00
|
|
|
// Purpose: wxTextEntryDialog class
|
1998-05-20 14:01:55 +00:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
2003-03-17 10:34:04 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-11-02 05:04:26 +00:00
|
|
|
#ifndef _WX_TEXTDLGG_H_
|
|
|
|
#define _WX_TEXTDLGG_H_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-06-28 21:39:49 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2005-08-31 23:48:11 +00:00
|
|
|
#if wxUSE_TEXTDLG
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#include "wx/dialog.h"
|
|
|
|
|
2002-06-23 13:51:32 +00:00
|
|
|
#if wxUSE_VALIDATORS
|
|
|
|
#include "wx/valtext.h"
|
2007-11-02 05:04:26 +00:00
|
|
|
#include "wx/textctrl.h"
|
2002-06-23 13:51:32 +00:00
|
|
|
#endif
|
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
|
1999-06-29 12:34:18 +00:00
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[];
|
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[];
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2002-06-23 13:51:32 +00:00
|
|
|
#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
|
2000-01-24 18:26:54 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-09-27 22:41:33 +00:00
|
|
|
wxTextEntryDialog()
|
|
|
|
{
|
|
|
|
m_textctrl = NULL;
|
|
|
|
}
|
|
|
|
|
1999-06-28 21:39:49 +00:00
|
|
|
wxTextEntryDialog(wxWindow *parent,
|
|
|
|
const wxString& message,
|
|
|
|
const wxString& caption = wxGetTextFromUserPromptStr,
|
|
|
|
const wxString& value = wxEmptyString,
|
2000-01-24 18:26:54 +00:00
|
|
|
long style = wxTextEntryDialogStyle,
|
2012-09-27 22:41:33 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition)
|
|
|
|
{
|
|
|
|
Create(parent, message, caption, value, style, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
const wxString& message,
|
|
|
|
const wxString& caption = wxGetTextFromUserPromptStr,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
long style = wxTextEntryDialogStyle,
|
|
|
|
const wxPoint& pos = wxDefaultPosition);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2002-02-20 13:52:46 +00:00
|
|
|
void SetValue(const wxString& val);
|
1999-06-28 21:39:49 +00:00
|
|
|
wxString GetValue() const { return m_value; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2013-04-20 22:13:33 +00:00
|
|
|
void SetMaxLength(unsigned long len);
|
|
|
|
|
2002-06-23 13:51:32 +00:00
|
|
|
#if wxUSE_VALIDATORS
|
2005-09-24 21:43:15 +00:00
|
|
|
void SetTextValidator( const wxTextValidator& validator );
|
2009-01-09 12:43:20 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_2_8
|
|
|
|
wxDEPRECATED( void SetTextValidator( long style ) );
|
|
|
|
#endif
|
|
|
|
void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE );
|
2002-06-23 13:51:32 +00:00
|
|
|
wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
|
2013-04-04 00:11:00 +00:00
|
|
|
#endif // wxUSE_VALIDATORS
|
|
|
|
|
|
|
|
virtual bool TransferDataToWindow();
|
|
|
|
virtual bool TransferDataFromWindow();
|
2002-06-23 13:51:32 +00:00
|
|
|
|
1999-06-28 21:39:49 +00:00
|
|
|
// implementation only
|
1998-05-20 14:01:55 +00:00
|
|
|
void OnOK(wxCommandEvent& event);
|
|
|
|
|
1999-06-28 21:39:49 +00:00
|
|
|
protected:
|
|
|
|
wxTextCtrl *m_textctrl;
|
|
|
|
wxString m_value;
|
2000-01-05 15:35:04 +00:00
|
|
|
long m_dialogStyle;
|
1999-06-28 21:39:49 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
2000-01-24 18:26:54 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog);
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2004-11-09 19:13:15 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel]
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog
|
2004-11-09 19:13:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-12-21 12:23:59 +00:00
|
|
|
wxPasswordEntryDialog();
|
2004-11-09 19:13:15 +00:00
|
|
|
wxPasswordEntryDialog(wxWindow *parent,
|
|
|
|
const wxString& message,
|
|
|
|
const wxString& caption = wxGetPasswordFromUserPromptStr,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
long style = wxTextEntryDialogStyle,
|
2013-12-21 12:23:59 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition)
|
|
|
|
{
|
|
|
|
Create(parent, message, caption, value, style, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
const wxString& message,
|
|
|
|
const wxString& caption = wxGetPasswordFromUserPromptStr,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
long style = wxTextEntryDialogStyle,
|
|
|
|
const wxPoint& pos = wxDefaultPosition);
|
|
|
|
|
|
|
|
|
2004-11-09 19:13:15 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog)
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog);
|
2004-11-09 19:13:15 +00:00
|
|
|
};
|
|
|
|
|
1999-07-22 23:39:47 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
1999-07-23 21:03:02 +00:00
|
|
|
// function to get a string from user
|
1999-07-22 23:39:47 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
WXDLLIMPEXP_CORE wxString
|
|
|
|
wxGetTextFromUser(const wxString& message,
|
|
|
|
const wxString& caption = wxGetTextFromUserPromptStr,
|
|
|
|
const wxString& default_value = wxEmptyString,
|
2009-01-19 13:55:27 +00:00
|
|
|
wxWindow *parent = NULL,
|
2008-03-26 15:06:00 +00:00
|
|
|
wxCoord x = wxDefaultCoord,
|
|
|
|
wxCoord y = wxDefaultCoord,
|
|
|
|
bool centre = true);
|
|
|
|
|
|
|
|
WXDLLIMPEXP_CORE wxString
|
|
|
|
wxGetPasswordFromUser(const wxString& message,
|
|
|
|
const wxString& caption = wxGetPasswordFromUserPromptStr,
|
|
|
|
const wxString& default_value = wxEmptyString,
|
2009-01-19 13:55:27 +00:00
|
|
|
wxWindow *parent = NULL,
|
2008-03-26 15:06:00 +00:00
|
|
|
wxCoord x = wxDefaultCoord,
|
|
|
|
wxCoord y = wxDefaultCoord,
|
|
|
|
bool centre = true);
|
2000-01-24 18:26:54 +00:00
|
|
|
|
2003-05-23 18:59:07 +00:00
|
|
|
#endif
|
|
|
|
// wxUSE_TEXTDLG
|
2007-11-02 05:04:26 +00:00
|
|
|
#endif // _WX_TEXTDLGG_H_
|