+extern wxWindowGTK *g_delayedFocus;
+
+// ----------------------------------------------------------------------------
+// helpers
+// ----------------------------------------------------------------------------
+
+#ifdef __WXGTK20__
+static void wxGtkTextInsert(GtkWidget *text,
+ GtkTextBuffer *text_buffer,
+ const wxTextAttr& attr,
+ wxCharBuffer buffer)
+
+{
+ PangoFontDescription *font_description = attr.HasFont()
+ ? attr.GetFont().GetNativeFontInfo()->description
+ : NULL;
+
+ GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor()
+ : NULL;
+
+ GdkColor *colBg = attr.HasBackgroundColour()
+ ? attr.GetBackgroundColour().GetColor()
+ : NULL;
+
+ GtkTextTag *tag;
+ tag = gtk_text_buffer_create_tag( text_buffer, NULL, "font-desc", font_description,
+ "foreground-gdk", colFg,
+ "background-gdk", colBg, NULL );
+
+ GtkTextIter iter;
+ gtk_text_buffer_get_iter_at_mark( text_buffer, &iter,
+ gtk_text_buffer_get_insert (text_buffer) );
+
+ gtk_text_buffer_insert_with_tags( text_buffer, &iter, buffer, strlen(buffer), tag, NULL );
+}
+#else
+static void wxGtkTextInsert(GtkWidget *text,
+ const wxTextAttr& attr,
+ const char *txt,
+ size_t len)
+{
+ GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont()
+ : NULL;
+
+ GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor()
+ : NULL;
+
+ GdkColor *colBg = attr.HasBackgroundColour()
+ ? attr.GetBackgroundColour().GetColor()
+ : NULL;
+
+ gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len );
+}
+#endif // GTK 1.x