+wxEllipsizeMode wxDataViewRenderer::GetEllipsizeMode() const
+{
+#ifdef __WXGTK26__
+#ifndef __WXGTK3__
+ if ( gtk_check_version(2, 6, 0) != NULL )
+ return wxELLIPSIZE_NONE;
+#endif
+
+ GtkCellRendererText * const rend = GtkGetTextRenderer();
+ if ( !rend )
+ return wxELLIPSIZE_NONE;
+
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, PANGO_TYPE_ELLIPSIZE_MODE );
+ g_object_get_property( G_OBJECT(rend), "ellipsize", &gvalue );
+ wxEllipsizeMode
+ mode = static_cast<wxEllipsizeMode>(g_value_get_enum( &gvalue ));
+ g_value_unset( &gvalue );
+
+ return mode;
+#else // GTK < 2.6
+ return wxELLIPSIZE_NONE;
+#endif // GTK 2.6/before
+}
+
+void
+wxDataViewRenderer::GtkOnTextEdited(const char *itempath, const wxString& str)
+{
+ wxVariant value(str);
+ if (!Validate( value ))
+ return;
+
+ wxDataViewItem
+ item(GetOwner()->GetOwner()->GTKPathToItem(wxGtkTreePath(itempath)));
+
+ GtkOnCellChanged(value, item, GetOwner()->GetModelColumn());
+}
+
+void
+wxDataViewRenderer::GtkOnCellChanged(const wxVariant& value,
+ const wxDataViewItem& item,
+ unsigned col)
+{
+ wxDataViewModel *model = GetOwner()->GetOwner()->GetModel();
+ model->ChangeValue( value, item, col );
+}
+
+// ---------------------------------------------------------
+// wxDataViewTextRenderer
+// ---------------------------------------------------------
+
+extern "C"
+{
+
+static void wxGtkTextRendererEditedCallback( GtkCellRendererText *WXUNUSED(renderer),
+ gchar *arg1, gchar *arg2, gpointer user_data )
+{
+ wxDataViewRenderer *cell = (wxDataViewRenderer*) user_data;
+
+ cell->GtkOnTextEdited(arg1, wxGTK_CONV_BACK_FONT(
+ arg2, cell->GetOwner()->GetOwner()->GetFont()));
+}
+
+}
+
+namespace
+{
+
+// helper function used by wxDataViewTextRenderer and
+// wxDataViewCustomRenderer::RenderText(): it applies the attributes to the
+// given text renderer and returns true if anything was done
+bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
+{
+ bool usingDefaultAttrs = true;
+ if (attr.HasColour())
+ {
+ const GdkColor * const gcol = attr.GetColour().GetColor();
+
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, GDK_TYPE_COLOR );
+ g_value_set_boxed( &gvalue, gcol );
+ g_object_set_property( G_OBJECT(renderer), "foreground_gdk", &gvalue );
+ g_value_unset( &gvalue );
+
+ usingDefaultAttrs = false;
+ }
+ else
+ {
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, G_TYPE_BOOLEAN );
+ g_value_set_boolean( &gvalue, FALSE );
+ g_object_set_property( G_OBJECT(renderer), "foreground-set", &gvalue );
+ g_value_unset( &gvalue );
+ }
+
+ if (attr.GetItalic())
+ {
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, PANGO_TYPE_STYLE );
+ g_value_set_enum( &gvalue, PANGO_STYLE_ITALIC );
+ g_object_set_property( G_OBJECT(renderer), "style", &gvalue );
+ g_value_unset( &gvalue );
+
+ usingDefaultAttrs = false;
+ }
+ else
+ {
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, G_TYPE_BOOLEAN );
+ g_value_set_boolean( &gvalue, FALSE );
+ g_object_set_property( G_OBJECT(renderer), "style-set", &gvalue );
+ g_value_unset( &gvalue );
+ }
+
+
+ if (attr.GetBold())
+ {
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, PANGO_TYPE_WEIGHT );
+ g_value_set_enum( &gvalue, PANGO_WEIGHT_BOLD );
+ g_object_set_property( G_OBJECT(renderer), "weight", &gvalue );
+ g_value_unset( &gvalue );
+
+ usingDefaultAttrs = false;
+ }
+ else
+ {
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, G_TYPE_BOOLEAN );
+ g_value_set_boolean( &gvalue, FALSE );
+ g_object_set_property( G_OBJECT(renderer), "weight-set", &gvalue );
+ g_value_unset( &gvalue );
+ }
+
+#if 0
+ if (attr.HasBackgroundColour())
+ {
+ wxColour colour = attr.GetBackgroundColour();
+ const GdkColor * const gcol = colour.GetColor();