Re: Clicking on a GtkCellRendererPixbuf



On Friday 05 December 2003 09:55, Calum Grant wrote:

I have a GtkTreeView, which contains several GtkCellRendererToggle
columns.  I'd like to replace them with a GtkCellRendererPixbuf column,
with three possible states.

I can change the pixbuf in the column no problems.  But I'd like the
column to respond to mouse clicks, like a GtkCellRendererToggle.  How do
I intercept mouse clicks to this column?

connect to the "button-press-event" signal on the treeview, and then use


  gtk_tree_view_get_path_at_pos(view, 
                                  (gint) buttonevent->x, 
                                  (gint) buttonevent->y, 
                                  &path, &column, NULL, NULL)

or something like that to determine the path and tree view column.

If you have multiple cell renderers packed into that column, things get a bit 
more tricky though.

Alternatively, you could write your own cell renderer I suppose :-)  

Cheers
 -Tim





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