Implement auto-completion support for wxTextEntry in wxOSX/Cocoa.

Both completing a set of fixed strings and dynamic completion using a custom
completer are supported, although completing the file names remains MSW-only
for now.

Note that, unlike under MSW, auto-completion under Mac is not automatic and
has to be triggered manually by calling complete: method. This is done by
pressing F5 key by default. In the future we should call it automatically on a
timer event to make it more obviously discoverable.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-04-17 23:14:15 +00:00
parent ed7dda9251
commit c729f16fa5
5 changed files with 90 additions and 24 deletions

View File

@@ -32,12 +32,8 @@ class WXDLLIMPEXP_CORE wxTextEntry: public wxTextEntryBase
{
public:
wxTextEntry()
: m_editable(true),
m_maxLength(0)
{ }
virtual ~wxTextEntry() {};
wxTextEntry();
virtual ~wxTextEntry();
virtual bool IsEditable() const;
@@ -88,10 +84,18 @@ public:
// --------------
virtual wxTextWidgetImpl * GetTextPeer() const;
wxTextCompleter *OSXGetCompleter() const { return m_completer; }
protected:
virtual wxString DoGetValue() const;
virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer);
// The object providing auto-completions or NULL if none.
wxTextCompleter *m_completer;
bool m_editable;
// need to make this public because of the current implementation via callbacks