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

@@ -60,6 +60,40 @@ public:
*/
bool AutoComplete(const wxArrayString& choices);
/**
Enable auto-completion using the provided completer object.
This method should be used instead of AutoComplete() overload taking
the array of possible completions if the total number of strings is too
big as it allows to return the completions dynamically, depending on
the text already entered by user and so is more efficient.
The specified @a completer object will be used to retrieve the list of
possible completions for the already entered text and will be deleted
by wxTextEntry itself when it's not needed any longer.
Notice that you need to include @c wx/textcompleter.h in order to
define your class inheriting from wxTextCompleter.
Currently this method is only implemented in wxMSW port.
@since 2.9.2
@param completer
The object to be used for generating completions if non-@NULL. If
it is @NULL, auto-completion is disabled. The wxTextEntry object
takes ownership of this pointer and will delete it in any case
(i.e. even if this method returns @false).
@return
@true if the auto-completion was enabled or @false if the operation
failed, typically because auto-completion is not supported by the
current platform.
@see wxTextCompleter
*/
bool AutoComplete(wxTextCompleter *completer);
/**
Call this function to enable auto-completion of the text typed in a
single-line text control using all valid file system paths.