Attempt at a custom cell renderer from CellRendererPixbuf



Hi Folks -

Been trying to get a custom cell renderer to work that is essentially a tweaked CellRendererPixbuf.  I got some sample code together with the help of one of the gtkmm demos and looking at Jonner's cell renderer implementation in Agave, however, it's not working.  Let me elaborate a bit:

- I created a class, StripRenderer, derived from CellRendererPixbuf.
- The constructor calls both Glib::ObjectBase(typeof(StripRenderer)) and Gtk::CellRendererPixbuf()
- When I assign this as the renderer for a TreeViewColumn, it appears to completely ignore my virtual funcs, get_size_vfunc and render_vfunc.  Both of these signatures/implementations are taken directly from Agave.  I tried doing stuff like aborting or breaking with gdb in those funcs and they never seem to get called.
- The behavior of the column that stores a pixbuf is exactly the same as a CellRendererPixbuf.  The sizing, rendering, everything works as if I never even switched the renderer.

I've put the code up at [1], it's quite small.  The renderer is in renderer.[cc|h] (difficult to figure that out) and the part where it gets attached to a column is in examplewindow.cc:94, rig_columns().  If someone could take a few minutes and poke at it, I would really appreciate it.  It's probably something very small. 

At the moment, it should probably make the cells really large, as I put a constant of 400 in there (although I did not write that section so I'm not sure the behavior is exact).

A small observation, if I remove the "protected" visibility marker in the renderer class before the two virtual functions, gcc doesn't complain a wink.  Shouldn't it, if I were making an override of a protected member public?

[1] http://d.minuslab.net/files/gtkmm-renderertest.tar.gz

cheers,
dave


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]