X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/005ac806ead92411ad4810d407df311e4a608302..0c993c6fdb83aa85e34c828c08a507ac9a353b15:/src/osx/textentry_osx.cpp diff --git a/src/osx/textentry_osx.cpp b/src/osx/textentry_osx.cpp index 3e2ca4f22d..8061d068e4 100644 --- a/src/osx/textentry_osx.cpp +++ b/src/osx/textentry_osx.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: Kevin Ollivier // Created: 1998-01-01 -// RCS-ID: $Id: textctrl.cpp 54820 2008-07-29 20:04:11Z SC $ +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -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() ; @@ -147,7 +160,12 @@ wxTextPos wxTextEntry::GetLastPosition() const void wxTextEntry::Remove(long from, long to) { - GetTextPeer()->Remove( from , to ) ; + { + EventsSuppressor noevents(this); + GetTextPeer()->Remove( from , to ); + } + + SendTextUpdatedEventIfAllowed(); } void wxTextEntry::SetSelection(long from, long to) @@ -157,12 +175,22 @@ void wxTextEntry::SetSelection(long from, long to) void wxTextEntry::WriteText(const wxString& str) { - GetTextPeer()->WriteText( str ) ; + { + EventsSuppressor noevents(this); + GetTextPeer()->WriteText( str ); + } + + SendTextUpdatedEventIfAllowed(); } void wxTextEntry::Clear() { - GetTextPeer()->Clear() ; + { + EventsSuppressor noevents(this); + GetTextPeer()->Clear(); + } + + SendTextUpdatedEventIfAllowed(); } bool wxTextEntry::IsEditable() const @@ -209,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