GtkWxCellRenderer *wxrenderer = (GtkWxCellRenderer *) renderer;
wxDataViewCustomRenderer *cell = wxrenderer->cell;
+ cell->window = window;
+ cell->widget = widget;
+ cell->background_area = (void*) background_area;
+ cell->cell_area = (void*) cell_area;
+ cell->expose_area = (void*) expose_area;
+ cell->flags = (int) flags;
+
GdkRectangle rect;
gtk_wx_cell_renderer_get_size (renderer, widget, cell_area,
&rect.x,
GtkTreePath *treepath = gtk_tree_path_new_from_string( path );
GtkTreeIter iter;
- cell->GetOwner()->GetOwner()->GetInternal()->get_iter( &iter, treepath );
+ cell->GetOwner()->GetOwner()->GtkGetInternal()->get_iter( &iter, treepath );
wxDataViewItem item( iter.user_data );
gtk_tree_path_free( treepath );
GValue gvalue = { 0, };
g_value_init( &gvalue, G_TYPE_STRING );
- g_value_set_string( &gvalue, wxGTK_CONV_FONT( tmp, GetOwner()->GetOwner()->GetFont() ) );
+ g_value_set_string( &gvalue, wxGTK_CONV( tmp ) );
g_object_set_property( G_OBJECT(m_renderer), "text", &gvalue );
g_value_unset( &gvalue );
GValue gvalue = { 0, };
g_value_init( &gvalue, G_TYPE_STRING );
g_object_get_property( G_OBJECT(m_renderer), "text", &gvalue );
- wxString tmp = wxGTK_CONV_BACK_FONT( g_value_get_string( &gvalue ),
- wx_const_cast(wxDataViewTextRenderer*, this)->GetOwner()->GetOwner()->GetFont() );
+ wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &gvalue ) );
g_value_unset( &gvalue );
value = tmp;
wxDataViewRenderer( varianttype, mode, align )
{
m_dc = NULL;
+ m_text_renderer = NULL;
if (no_init)
m_renderer = NULL;
void wxDataViewCustomRenderer::RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state )
{
+#if 0
wxDataViewCtrl *view = GetOwner()->GetOwner();
wxColour col = (state & wxDATAVIEW_CELL_SELECTED) ?
wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) :
view->GetForegroundColour();
dc->SetTextForeground(col);
dc->DrawText( text, cell.x + xoffset, cell.y + ((cell.height - dc->GetCharHeight()) / 2));
+#else
+ if (!m_text_renderer)
+ m_text_renderer = gtk_cell_renderer_text_new();
+
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, G_TYPE_STRING );
+ g_value_set_string( &gvalue, wxGTK_CONV( text ) );
+ g_object_set_property( G_OBJECT(m_text_renderer), "text", &gvalue );
+ g_value_unset( &gvalue );
+
+ ((GdkRectangle*) cell_area)->x += xoffset;
+ ((GdkRectangle*) cell_area)->width -= xoffset;
+
+ gtk_cell_renderer_render( m_text_renderer,
+ window,
+ widget,
+ (GdkRectangle*) background_area,
+ (GdkRectangle*) cell_area,
+ (GdkRectangle*) expose_area,
+ (GtkCellRendererState) flags );
+
+ ((GdkRectangle*) cell_area)->x -= xoffset;
+ ((GdkRectangle*) cell_area)->width += xoffset;
+#endif
}
bool wxDataViewCustomRenderer::Init(wxDataViewCellMode mode, int align)
{
if (m_dc)
delete m_dc;
+
+ if (m_text_renderer)
+ gtk_object_sink( GTK_OBJECT(m_text_renderer) );
}
wxDC *wxDataViewCustomRenderer::GetDC()
GValue gvalue = { 0, };
g_value_init( &gvalue, G_TYPE_STRING );
- // FIXME: font encoding support
- g_value_set_string( &gvalue, wxGTK_CONV_SYS(m_label) );
+ g_value_set_string( &gvalue, wxGTK_CONV(m_label) );
g_object_set_property( G_OBJECT(m_renderer), "text", &gvalue );
g_value_unset( &gvalue );