textentry.h 3.4 KB

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