Re: Popup menus for GtkTreeView



On Fri, 2006-02-24 at 22:41 -0600, Federico Mena Quintero wrote:
> I want a context-sensitive menu in a GtkTreeView.

[snip on heavy hackery and m4d sk1llz]

> We need a signal in GtkTreeView like this:
> 
> gboolean (* tree_popup_menu) (GtkTreeView       *tree_view,
> 			      int                button,    /* 0 if keyboard */
> 			      guint32	         timestamp,
> 			      GtkTreePath       *path,      /* or an iter if you wish */
> 			      GtkTreeViewColumn *column);
> 
> That signal should get emitted automatically when one presses button 3
> on the treeview, and it should already have the right rows selected.
> The button argument should be 0 when the signal didn't happen through a
> mouse button, but through the keyboard's "popup-menu" binding.

Since, as you say below:

> It may also need a way to discriminate which particular cell renderer on
> which the button press landed, or even the coordinates within that
> renderer, for the true perverts who would find that stuff useful.

couldn't it simply relay the GdkEvent from which we can infer the type
(button or key or whatever) and drop the <button,timestamp> tuple?  The
GdkEvent would give us the coordinates for the exact renderer using the
gtk_tree_view_get_path_at_pos().

Otherwise, you would have to pass the <x,y> coordinates too, and that
would make it look a bit uglier.

Other than that, I think it could be useful to have this signal.

Ciao,
 Emmanuele.

-- 
Emmanuele Bassi - <ebassi gmail com>
Log: http://log.emmanuelebassi.net




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