How do I create a multi column popup menu



Hi list.
(I am not subscribed but reads the list through the web archive interface.)

I am one of the developers of a GPL application that uses the GTK toolkit
(www.ethereal.com  (.com
since .org was already taken))

I have one problem now that I dont know how to solve:
Some of the popup menus in ethereal have a lot of different menu items on
them,  so many that the menu is higher than the screen height and
thus not all of them can be seen.
I have seen applications that do popup menus that are multicolumn.

Can someone please tell me or show with a small example how I can create a
multicolumn popup menu?
(beware  the code must support both gtk1.2 and gtk2,  we have some
compatibility macros to help do this with a single common codebase)

Dont laugh at the code,   Im not a toolkit person.  I do protocols, not
gui's.   Its based on cut-n-paste from examples.  It works.


-------
The first instance is when needing to create a popup menu at runtime.   It
is created this way since we dont know at compile time how many items
the menu will have or what they will be.  So there is some code to create a
menu and then a loop with callbacks to add the actual entries to it:

(gtk/dcerpc_stat.c)
This snippet creates the menu and goes through an enumerator
(g_hash_table_foreach() to add all the items)
    /* Program menu */
    prog_opt=gtk_option_menu_new();
    prog_menu=gtk_menu_new();
    g_hash_table_foreach(dcerpc_uuids, (GHFunc)dcerpcstat_list_programs,
NULL);
    gtk_option_menu_set_menu(GTK_OPTION_MENU(prog_opt), prog_menu);
    gtk_box_pack_start(GTK_BOX(prog_box), prog_opt, TRUE, TRUE, 0);
    gtk_widget_show(prog_opt);

The individual menu items are added as :
    menu_item=gtk_menu_item_new_with_label(v->name);
    SIGNAL_CONNECT(menu_item, "activate", dcerpcstat_program_select, k);
    gtk_widget_show(menu_item);
    gtk_menu_append(GTK_MENU(prog_menu), menu_item);


Question:   How can I up in the snippet above specify that there should be a
vertical separator to split the menu in two (or more) columns?



thanks for any response
    ronnie sahlberg






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