2010-01-09 14:50:55 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/osx/textentry.h
|
|
|
|
// Purpose: wxTextEntry class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by: Kevin Ollivier
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// Copyright: (c) Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_OSX_TEXTENTRY_H_
|
|
|
|
#define _WX_OSX_TEXTENTRY_H_
|
|
|
|
|
|
|
|
#if wxUSE_SYSTEM_OPTIONS
|
|
|
|
// set this to 'true' if you want to use the 'classic' MLTE-based implementation
|
|
|
|
// instead of the HIView-based implementation in 10.3 and upwards, the former
|
|
|
|
// has more features (backgrounds etc.), but may show redraw artefacts and other
|
|
|
|
// problems depending on your usage; hence, the default is 'false'.
|
|
|
|
#define wxMAC_TEXTCONTROL_USE_MLTE wxT("mac.textcontrol-use-mlte")
|
|
|
|
// set this to 'true' if you want editable text controls to have spell checking turned
|
|
|
|
// on by default, you can change this setting individually on a control using MacCheckSpelling
|
|
|
|
#define wxMAC_TEXTCONTROL_USE_SPELL_CHECKER wxT("mac.textcontrol-use-spell-checker")
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
|
|
|
// forward decl for wxListWidgetImpl implementation type.
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxTextWidgetImpl;
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxTextEntry: public wxTextEntryBase
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2011-04-17 19:14:15 -04:00
|
|
|
wxTextEntry();
|
|
|
|
virtual ~wxTextEntry();
|
2010-01-09 14:50:55 -05:00
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool IsEditable() const wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
|
|
|
// If the return values from and to are the same, there is no selection.
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void GetSelection(long* from, long* to) const wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
|
|
|
// operations
|
|
|
|
// ----------
|
|
|
|
|
|
|
|
// editing
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void Clear() wxOVERRIDE;
|
|
|
|
virtual void Remove(long from, long to) wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
|
|
|
// set the max number of characters which may be entered
|
|
|
|
// in a single line text control
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void SetMaxLength(unsigned long len) wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void ForceUpper() wxOVERRIDE;
|
2015-11-24 21:40:40 -05:00
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
// writing text inserts it at the current position;
|
|
|
|
// appending always inserts it at the end
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void WriteText(const wxString& text) wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
|
|
|
// Clipboard operations
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void Copy() wxOVERRIDE;
|
|
|
|
virtual void Cut() wxOVERRIDE;
|
|
|
|
virtual void Paste() wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool CanCopy() const wxOVERRIDE;
|
|
|
|
virtual bool CanCut() const wxOVERRIDE;
|
|
|
|
virtual bool CanPaste() const wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
|
|
|
// Undo/redo
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void Undo() wxOVERRIDE;
|
|
|
|
virtual void Redo() wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool CanUndo() const wxOVERRIDE;
|
|
|
|
virtual bool CanRedo() const wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
|
|
|
// Insertion point
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void SetInsertionPoint(long pos) wxOVERRIDE;
|
|
|
|
virtual void SetInsertionPointEnd() wxOVERRIDE;
|
|
|
|
virtual long GetInsertionPoint() const wxOVERRIDE;
|
2019-04-17 13:05:31 -04:00
|
|
|
virtual wxTextPos GetLastPosition() const wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual void SetSelection(long from, long to) wxOVERRIDE;
|
|
|
|
virtual void SetEditable(bool editable) wxOVERRIDE;
|
2010-01-09 14:50:55 -05:00
|
|
|
|
2013-06-12 18:04:38 -04:00
|
|
|
virtual bool SendMaxLenEvent();
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
// set the grayed out hint text
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool SetHint(const wxString& hint) wxOVERRIDE;
|
|
|
|
virtual wxString GetHint() const wxOVERRIDE;
|
2013-11-12 13:06:37 -05:00
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
// Implementation
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
virtual wxTextWidgetImpl * GetTextPeer() const;
|
2011-04-17 19:14:15 -04:00
|
|
|
wxTextCompleter *OSXGetCompleter() const { return m_completer; }
|
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
protected:
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual wxString DoGetValue() const wxOVERRIDE;
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool DoAutoCompleteStrings(const wxArrayString& choices) wxOVERRIDE;
|
|
|
|
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE;
|
2011-04-17 19:14:15 -04:00
|
|
|
|
|
|
|
// The object providing auto-completions or NULL if none.
|
|
|
|
wxTextCompleter *m_completer;
|
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
bool m_editable;
|
|
|
|
|
|
|
|
// need to make this public because of the current implementation via callbacks
|
|
|
|
unsigned long m_maxLength;
|
|
|
|
|
2013-11-12 13:06:37 -05:00
|
|
|
private:
|
|
|
|
wxString m_hintString;
|
2010-01-09 14:50:55 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_OSX_TEXTENTRY_H_
|