]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/textentry_osx.cpp
adapting to init pattern
[wxWidgets.git] / src / osx / textentry_osx.cpp
index 9fad59280c0a8fb3c678d8254f3a3f2de0c01575..8061d068e40f22e28d446f0cb5939f8e8a5d9679 100644 (file)
 #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<wxTextWidgetImpl *>(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