1 ///////////////////////////////////////////////////////////////////////////// 2 // Name: wx/osx/textentry.h 3 // Purpose: wxTextEntry class 4 // Author: Stefan Csomor 5 // Modified by: Kevin Ollivier 6 // Created: 1998-01-01 7 // Copyright: (c) Stefan Csomor 8 // Licence: wxWindows licence 9 ///////////////////////////////////////////////////////////////////////////// 10 11 #ifndef _WX_OSX_TEXTENTRY_H_ 12 #define _WX_OSX_TEXTENTRY_H_ 13 14 #if wxUSE_SYSTEM_OPTIONS 15 // set this to 'true' if you want to use the 'classic' MLTE-based implementation 16 // instead of the HIView-based implementation in 10.3 and upwards, the former 17 // has more features (backgrounds etc.), but may show redraw artefacts and other 18 // problems depending on your usage; hence, the default is 'false'. 19 #define wxMAC_TEXTCONTROL_USE_MLTE wxT("mac.textcontrol-use-mlte") 20 // set this to 'true' if you want editable text controls to have spell checking turned 21 // on by default, you can change this setting individually on a control using MacCheckSpelling 22 #define wxMAC_TEXTCONTROL_USE_SPELL_CHECKER wxT("mac.textcontrol-use-spell-checker") 23 #endif 24 25 #include "wx/control.h" 26 27 // forward decl for wxListWidgetImpl implementation type. 28 class WXDLLIMPEXP_FWD_CORE wxTextWidgetImpl; 29 30 class WXDLLIMPEXP_CORE wxTextEntry: public wxTextEntryBase 31 { 32 33 public: 34 wxTextEntry(); 35 virtual ~wxTextEntry(); 36 37 virtual bool IsEditable() const; 38 39 // If the return values from and to are the same, there is no selection. 40 virtual void GetSelection(long* from, long* to) const; 41 42 // operations 43 // ---------- 44 45 // editing 46 virtual void Clear(); 47 virtual void Remove(long from, long to); 48 49 // set the max number of characters which may be entered 50 // in a single line text control 51 virtual void SetMaxLength(unsigned long len); 52 53 // writing text inserts it at the current position; 54 // appending always inserts it at the end 55 virtual void WriteText(const wxString& text); 56 57 // Clipboard operations 58 virtual void Copy(); 59 virtual void Cut(); 60 virtual void Paste(); 61 62 virtual bool CanCopy() const; 63 virtual bool CanCut() const; 64 virtual bool CanPaste() const; 65 66 // Undo/redo 67 virtual void Undo(); 68 virtual void Redo(); 69 70 virtual bool CanUndo() const; 71 virtual bool CanRedo() const; 72 73 // Insertion point 74 virtual void SetInsertionPoint(long pos); 75 virtual void SetInsertionPointEnd(); 76 virtual long GetInsertionPoint() const; 77 virtual wxTextPos GetLastPosition() const; 78 79 virtual void SetSelection(long from, long to); 80 virtual void SetEditable(bool editable); 81 82 virtual bool SendMaxLenEvent(); 83 84 // set the grayed out hint text 85 virtual bool SetHint(const wxString& hint); 86 virtual wxString GetHint() const; 87 88 // Implementation 89 // -------------- 90 91 virtual wxTextWidgetImpl * GetTextPeer() const; OSXGetCompleter()92 wxTextCompleter *OSXGetCompleter() const { return m_completer; } 93 94 protected: 95 96 virtual wxString DoGetValue() const; 97 98 virtual bool DoAutoCompleteStrings(const wxArrayString& choices); 99 virtual bool DoAutoCompleteCustom(wxTextCompleter *completer); 100 101 // The object providing auto-completions or NULL if none. 102 wxTextCompleter *m_completer; 103 104 bool m_editable; 105 106 // need to make this public because of the current implementation via callbacks 107 unsigned long m_maxLength; 108 109 private: 110 wxString m_hintString; 111 }; 112 113 #endif // _WX_OSX_TEXTENTRY_H_ 114