Re: [gtk-list] Menu blues
- From: John Kodis <kodis jagunet com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Menu blues
- Date: Sat, 12 Feb 2000 08:45:35 -0500
On Fri, Feb 11, 2000 at 09:56:39PM -0600, Sean Cody wrote:
> Anyone seen the blackbox type menus??? (right click and get a list of
> items with sub-menus yada yada yada).
> { ... snip ... }
> I guess basically what I want to say is "is it possible to use menu bar
> functionality without using a menu bar"?
I've never set up submenus, but menus without a menu bar are easy.
Use something like this:
static void
menu_popup(GtkWidget *widget, GdkEvent *event, Chart_app_t *app)
{
static GtkWidget *menu;
if (menu == NULL)
{
GtkWidget *menu_item;
menu = gtk_menu_new();
menu_item = gtk_menu_item_new_with_label(_("Help"));
gtk_menu_append(GTK_MENU(menu), menu_item);
gtk_signal_connect_object(GTK_OBJECT(menu_item),
"activate", GTK_SIGNAL_FUNC(on_help_menu), GTK_OBJECT(widget));
/* Repeat as required to set up all menu entries. Use
* gtk_menu_append(GTK_MENU(menu), gtk_menu_item_new());
* to create empty "seperator bar" menu entries. */
gtk_widget_show_all(menu);
}
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
((GdkEventButton*)event)->button, ((GdkEventButton*)event)->time);
}
Setting up submenus should be a simple matter of repeating this
pattern to create menu popup routines for the nested submenus, and
attaching these submenu routines to the "activate" signal of their
parent menu items.
-- John Kodis.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]