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