Add support for dynamic auto-completion in wxTextEntry.

Add wxTextCompleter class which allows to return the possible completions
dynamically and wxTextCompleter::AutoComplete() overload using it. So far this
is only implemented for wxMSW.

Also fix calling wxTextEntry::AutoComplete(wxArrayString) multiple times under
MSW, this didn't correctly update the list of shown completions before.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-04-16 17:27:16 +00:00
parent 6b30ffedb1
commit ea98f11c2f
15 changed files with 613 additions and 65 deletions

View File

@@ -16,6 +16,7 @@
typedef long wxTextPos;
class WXDLLIMPEXP_FWD_BASE wxArrayString;
class WXDLLIMPEXP_FWD_CORE wxTextCompleter;
class WXDLLIMPEXP_FWD_CORE wxTextEntryHintData;
class WXDLLIMPEXP_FWD_CORE wxWindow;
@@ -106,7 +107,7 @@ public:
// these functions allow to auto-complete the text already entered into the
// control using either the given fixed list of strings, the paths from the
// file system or, in the future, an arbitrary user-defined completer
// file system or an arbitrary user-defined completer
//
// they all return true if completion was enabled or false on error (most
// commonly meaning that this functionality is not available under the
@@ -118,6 +119,12 @@ public:
bool AutoCompleteFileNames()
{ return DoAutoCompleteFileNames(); }
// notice that we take ownership of the pointer and will delete it
//
// if the pointer is NULL auto-completion is disabled
bool AutoComplete(wxTextCompleter *completer)
{ return DoAutoCompleteCustom(completer); }
// status
// ------
@@ -224,6 +231,7 @@ protected:
virtual bool DoAutoCompleteStrings(const wxArrayString& WXUNUSED(choices))
{ return false; }
virtual bool DoAutoCompleteFileNames() { return false; }
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer);
// class which should be used to temporarily disable text change events