-#ifdef __WXGTK20__
-
-#if wxUSE_UNICODE
- wxCharBuffer buffer( wxConvUTF8.cWX2MB( text ) );
-#else
- wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
-#endif
- if ( !buffer )
- {
- // what else can we do? at least don't crash...
- return;
- }
-
- // TODO: Call whatever is needed to delete the selection.
- wxGtkTextInsert( m_text, m_buffer, m_defaultStyle, buffer );
-
- GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(m_widget) );
- // Scroll to cursor, but only if scrollbar thumb is at the very bottom
- if ( adj->value == adj->upper - adj->page_size )
- {
- gtk_text_view_scroll_to_mark( GTK_TEXT_VIEW(m_text),
- gtk_text_buffer_get_insert( m_buffer ), 0.0, FALSE, 0.0, 1.0 );
- }
-#else // GTK 1.x
- // After cursor movements, gtk_text_get_point() is wrong by one.
- gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) );
-
- // always use m_defaultStyle, even if it is empty as otherwise
- // resetting the style and appending some more text wouldn't work: if
- // we don't specify the style explicitly, the old style would be used
- gtk_editable_delete_selection( GTK_EDITABLE(m_text) );
- wxGtkTextInsert(m_text, m_defaultStyle, text.c_str(), text.Len());
-
- // we called wxGtkTextInsert with correct font, no need to do anything
- // in UpdateFontIfNeeded() any longer
- if ( !text.empty() )
- {
- SetUpdateFont(false);
- }
-
- // Bring editable's cursor back uptodate.
- SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) ));
-#endif // GTK 1.x/2.0