]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/textentry_osx.cpp
Fix wxMSW rendering artifacts with modal dialogs.
[wxWidgets.git] / src / osx / textentry_osx.cpp
index 680a4fdcfbcb9afa0af3749a6b2743d6e12ab09c..7fef5e282d49c51ea59d722c2045928ab8990c58 100644 (file)
@@ -147,7 +147,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 +162,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
@@ -204,7 +219,9 @@ bool wxTextEntry::CanRedo() const
 
 wxTextWidgetImpl * wxTextEntry::GetTextPeer() const
 {
-    wxFAIL_MSG("You need to implement wxTextWidgetImpl* GetTextPeer() in your wxTextEntry subclass if you want to use the native impls of its methods.");
-    return NULL;
+    wxWindow * const win = const_cast<wxTextEntry *>(this)->GetEditableWindow();
+
+    return win ? dynamic_cast<wxTextWidgetImpl *>(win->GetPeer()) : NULL;
 }
+
 #endif // wxUSE_TEXTCTRL