Unable to implement CellRenderer.render with ImplementClass
MaeIsBad opened this issue · 2 comments
MaeIsBad commented
This is a follow up to #325 but since I cannot reopen it I've decided to make a new issue
If I try to implement the render method using the master version of the library from git I get an gtk_cell_renderer_render: assertion 'GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL' failed
error
Minimal reproducible example
import std.stdio;
import gtk.CellRenderer;
import cairo.Context;
import gtk.TreeView;
import gtk.TreeViewColumn;
import gtk.ListStore;
import gtk.Widget;
import gtk.Main;
import gtk.MainWindow;
class Renderer: CellRenderer {
import gtkd.Implement;
import gobject.c.functions : g_object_newv;
mixin ImplementClass!GtkCellRenderer;
this() {
super(cast(GtkCellRenderer*)g_object_newv(getType(), 0, null), true);
}
override void render(Context cr, Widget widget, GdkRectangle* backgroundArea, GdkRectangle* cellArea, GtkCellRendererState flags) {
}
}
void main(string[] args)
{
Main.init(args);
ListStore ls = new ListStore([GType.INT]);
ls.setValue(ls.createIter(), 0, 0);
Renderer r = new Renderer();
TreeViewColumn col = new TreeViewColumn("test", r, "test", 0);
TreeView view = new TreeView();
view.setModel(ls);
view.appendColumn(col);
MainWindow win = new MainWindow("test");
win.add(view);
win.showAll();
Main.run();
}
MikeWey commented
It might have something to do with the private part of GtkCellRenderer. I'll have to take a closer look.
MaeIsBad commented
Thank you very much!