Easier menu creation

From: Date: Mon, 05 Mar 2001 00:37:30 +0000
Subject: Easier menu creation
Groups: php.gtk 
Request: Send a blank email to php-gtk+get-258@lists.php.net to get a copy of this message
I've implemented easier menu creation via GtkItemFactory. Here's how it works: $window = &new GtkWindow(); $ag = &new GtkAccelGroup(); $itemf = &new GtkItemFactory(GtkMenuBar::get_type(), '<main>', $ag); $window->add_accel_group($ag); $itemf->create_items(array( array('/_File', '', null, 0, '<Branch>'), array('/_File/_New', '<control>N', 'file_cb', 1, ''), array('/_File/sep1', '', null, 0, '<Separator>'), array('/_File/E_xit', '<control>X', 'file_cb', 2, ''))); $window->add($itemf->get_widget('<main>')); The structure of each factory item is as follows: * path * accelerator binding * callback (or null) * callback action (allows you to distinguish which item was * selected) * item type (see http://developer.gnome.org/doc/API/gtk/gtkitemfactory.html#GTKITEMFACTORYENTRY for possible values for this) Hope this helps, -Andrei

« previous php.gtk (#258) next »