- // use the attributes from style which are set in it and fall back
- // first to the default style and then to the text control default
- // colours for the others
- wxTextAttr attr = wxTextAttr::Combine(style, m_defaultStyle, this);
-
- wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
-#else
- // VERY dirty way to do that - removes the required text and re-adds it
- // with styling (FIXME)
-
- gint l = gtk_text_get_length( GTK_TEXT(m_text) );
-
- wxCHECK_MSG( start >= 0 && end <= l, false,
- _T("invalid range in wxTextCtrl::SetStyle") );
-
- gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) );
- char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), start, end );
- wxString tmp(text,*wxConvCurrent);
- g_free( text );
-
- gtk_editable_delete_text( GTK_EDITABLE(m_text), start, end );
- gtk_editable_set_position( GTK_EDITABLE(m_text), start );
-
- #if wxUSE_UNICODE
- wxWX2MBbuf buf = tmp.mbc_str();
- const char *txt = buf;
- size_t txtlen = strlen(buf);
- #else
- const char *txt = tmp;
- size_t txtlen = tmp.length();
- #endif
-
- // use the attributes from style which are set in it and fall back
- // first to the default style and then to the text control default
- // colours for the others
- wxGtkTextInsert(m_text,
- wxTextAttr::Combine(style, m_defaultStyle, this),
- txt,
- txtlen);
-
- /* does not seem to help under GTK+ 1.2 !!!
- gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
- SetInsertionPoint( old_pos );
-#endif