Popup menu in GtkTreeViewColumn header?



Hi,

I am trying to add a popup menu to a GtkTreeViewColumn header. How?

I've been trying to replace the header-widget with a menubar
corresponding infrastructure attached to it, it this doesn't seem to
work as intended.

Code fragment [1]
...
    GtkWidget *menubar = gtk_menu_bar_new();
    GtkWidget *pulldown = gtk_menu_new();
    [Filling pulldown with menu items]

    GtkWidget *submenu = gtk_menu_item_new_with_label("Palettes1");
    gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenu), pulldown);
    gtk_menu_shell_append(GTK_MENU_SHELL(menubar), submenu);
...
    [Setting up treeview]
    GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(
        "Palettes2", renderer,
        "text", 0,	// column
        NULL);
    gtk_tree_view_column_set_widget(column,menubar);
    gtk_tree_view_column_set_clickable(column,TRUE);
...

A header labeled "Palettes1 is displayed, is clickable, but the popup
menu doesn't show up.

If putting the menubar and the treeview into a vbox, the popup menu
shows up as desired, however this is not what I actually want.

What am I missing? Am I supposed to manually popup the menu from inside
a "clicked" signal handler attached to the column's header widget?


Ralf


[1] This is C++; I am using the c-API inside of C++ code.





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