Re: Creating SubMenus



G'Day !

Try this function ...

/*
 * CreateBarSubMenu
 *
 * Create a submenu within an existing submenu.  (In other words, it's not
 * the menubar.)
 *
 * menu - existing submenu
 * szName - label to be given to the new submenu off of this submenu
 *
 * returns new menu widget
 */
GtkWidget *CreateBarSubMenu (GtkWidget *menu, char *szName)
{
    GtkWidget *menuitem;
    GtkWidget *submenu;

    /* --- Create menu --- */
    menuitem = gtk_menu_item_new_with_label (szName);

    /* --- Add it to the menubar --- */
    gtk_menu_bar_append (GTK_MENU_BAR (menu), menuitem);
    gtk_widget_show (menuitem);

    /* --- Get a menu and attach to the menuitem --- */
    submenu = gtk_menu_new ();
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);

    /* --- Viola! --- */
    return (submenu);
}

cheers,
Jim Parker

Sailboat racing is not a matter of life and death ....  It is far more important
than that !!!


                                                                                                              
                    
                    "Nicolas Raitman"                                                                         
                    
                    <new_world radar com ar>        To:     "gtk app" <gtk-app-devel-list gnome org>          
                    
                    Sent by:                        cc:                                                       
                    
                    gtk-app-devel-list-admin        Subject:     Creating SubMenus                            
                    
                    @gnome.org                                                                                
                    
                                                                                                              
                    
                                                                                                              
                    
                    11/30/00 05:00 AM                                                                         
                    
                                                                                                              
                    
                                                                                                              
                    



Hi to all. I know how t create menus and menuitems, but suppose I want to
have the following structure.

Edit
Font
Bold
Italic

Do you understand? How can I do this? I know that I cannot do it with the
ItemFactory, that's why I am doing it in the complex way, creating each
thing, but I could not find out how to create a sub menu.

Thanks a lot,
Nicolas


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list








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