Playing with Gtk

grantm on 2004-07-23T02:15:00

I'm currently playing around with a pet project that uses Gtk2. After I add a bit of handler code or a new widget, I run the program and find myself resizing the windows back and forth, clicking and dragging and generally messing about far longer than is necessary. Well I did say I was playing :-)

My current challenge involves a Gtk2::TreeView. I think I've got my head around the MVC theory and the GTK mechanics and I even have it working for the simple case where every row contains text. However I really want some of the rows to contain a separator bar that at looks like a Gtk2::HSeparator. Anyone know how to achieve that?

Sadly Pango markup does not support the <hr> tag or it would be pretty simple. I'm wondering if I'll have to write my own cell-renderer and if that's even possible from Perl. Anyway I'm having fun.


Custom cell render

grantm on 2004-07-30T10:32:23

for the record, I was able to implement custom cell rendering. One column value in my model was used to flag whether the cell was rendered as text or as a separator; another column contained the text (if any).

I got the basic elements of the solution from this script in the gtk-perl examples directory. In my RENDER method I used $widget->get_style->paint_shadow to draw the separator box although I might try paint_box with a "bar" style.