]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/textctrl.cpp
add very simple (but already exposing many problems) wxIPC benchmark
[wxWidgets.git] / src / gtk / textctrl.cpp
index 340ab8038f48836d8ef229ddca1dd3eceb2227a0..e30c23e4da3e16a6c1facb586dcde0c5c32ea86e 100644 (file)
@@ -685,8 +685,9 @@ bool wxTextCtrl::Create( wxWindow *parent,
 
         if (style & wxNO_BORDER)
             g_object_set (m_text, "has-frame", FALSE, NULL);
-            
+
     }
+    g_object_ref(m_widget);
 
     m_parent->DoAddChild( this );
 
@@ -959,15 +960,18 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags )
     {
         if ( !(flags & SetValue_SendEvent) )
             EnableTextChangedEvents(false);
-        
+
         gtk_text_buffer_set_text( m_buffer, "", 0 );
-            
+
         if ( !(flags & SetValue_SendEvent) )
             EnableTextChangedEvents(true);
-            
+
         return;
     }
 
+#if wxUSE_UNICODE
+    const wxCharBuffer buffer(value.utf8_str());
+#else
     wxFontEncoding enc = m_defaultStyle.HasFont()
                             ? m_defaultStyle.GetFont().GetEncoding()
                             : wxFONTENCODING_SYSTEM;
@@ -982,6 +986,7 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags )
         wxLogWarning(_("Failed to set text in the text control."));
         return;
     }
+#endif
 
     if ( !(flags & SetValue_SendEvent) )
     {
@@ -1002,9 +1007,6 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags )
     {
         EnableTextChangedEvents(true);
     }
-
-    // This was added after discussion on the list
-    SetInsertionPoint(0);
 }
 
 void wxTextCtrl::WriteText( const wxString &text )
@@ -1020,6 +1022,9 @@ void wxTextCtrl::WriteText( const wxString &text )
         return;
     }
 
+#if wxUSE_UNICODE
+    const wxCharBuffer buffer(text.utf8_str());
+#else
     // check if we have a specific style for the current position
     wxFontEncoding enc = wxFONTENCODING_SYSTEM;
     wxTextAttr style;
@@ -1040,6 +1045,7 @@ void wxTextCtrl::WriteText( const wxString &text )
         wxLogWarning(_("Failed to insert text in the control."));
         return;
     }
+#endif
 
     // First remove the selection if there is one
     // TODO:  Is there an easier GTK specific way to do this?