X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b5b208a1796ecf1b9ab267d200705b4f3b4d10e3..f599a4150940488037e48490e0041171884682ad:/src/osx/textentry_osx.cpp?ds=sidebyside diff --git a/src/osx/textentry_osx.cpp b/src/osx/textentry_osx.cpp index 9fad59280c..8061d068e4 100644 --- a/src/osx/textentry_osx.cpp +++ b/src/osx/textentry_osx.cpp @@ -45,9 +45,22 @@ #include "wx/filefn.h" #include "wx/sysopt.h" #include "wx/thread.h" +#include "wx/textcompleter.h" #include "wx/osx/private.h" +wxTextEntry::wxTextEntry() +{ + m_completer = NULL; + m_editable = true; + m_maxLength = 0; +} + +wxTextEntry::~wxTextEntry() +{ + delete m_completer; +} + wxString wxTextEntry::DoGetValue() const { return GetTextPeer()->GetStringValue() ; @@ -151,7 +164,7 @@ void wxTextEntry::Remove(long from, long to) EventsSuppressor noevents(this); GetTextPeer()->Remove( from , to ); } - + SendTextUpdatedEventIfAllowed(); } @@ -224,4 +237,23 @@ wxTextWidgetImpl * wxTextEntry::GetTextPeer() const return win ? dynamic_cast(win->GetPeer()) : NULL; } +// ---------------------------------------------------------------------------- +// Auto-completion +// ---------------------------------------------------------------------------- + +bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices) +{ + wxTextCompleterFixed * const completer = new wxTextCompleterFixed; + completer->SetCompletions(choices); + + return DoAutoCompleteCustom(completer); +} + +bool wxTextEntry::DoAutoCompleteCustom(wxTextCompleter *completer) +{ + m_completer = completer; + + return true; +} + #endif // wxUSE_TEXTCTRL