PHP-GTK
Friday, December 19, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkImageMenuItem
GtkImageMenuItem::get_imagenext

Last updated: Sun, 12 May 2013
view this page in English

GtkImageMenuItem Constructor

GtkImageMenuItem ([string label]);

Use the constructor to generate a new menu item with an icon. You may pass a string as the label, or a stock id, if you want to use the existing stock icons.

You may even precede a character of the label with an _ to indicate the mnemonic for the menu item.

Example 76. Creating image menu items

<?php
//Example: using GtkSeparatorMenuItems to
// separate menu items
 
//Create a menu bar
$mbar  = new GtkMenuBar();
//Add a menu item
$file  = new GtkMenuItem('_File');
//with a submenu
$fmenu = new GtkMenu();
$file->set_submenu($fmenu);
$mbar->add($file);
 
//Now, we create a "normal" file menu:
// New, Open, Save, Save As, Quit
//To make it visually appealing, we separate
// the items with GtkSeparatorMenuItems
$fmenu->add(new GtkImageMenuItem(Gtk::STOCK_NEW));
$fmenu->add(new GtkImageMenuItem(Gtk::STOCK_OPEN));
 
$fmenu->add(new GtkSeparatorMenuItem());
 
$fmenu->add(new GtkImageMenuItem(Gtk::STOCK_SAVE));
$fmenu->add(new GtkImageMenuItem(Gtk::STOCK_SAVE_AS));
 
$fmenu->add(new GtkSeparatorMenuItem());
 
$fmenu->add(new GtkImageMenuItem(Gtk::STOCK_QUIT));
 
 
//standard stuff
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$wnd->add($mbar);
$wnd->show_all();
Gtk::main();
?>

User Contributed Notes
gtk.gtkimagemenuitem.constructor.php
add a note about notes
There are no user contributed notes for this page.


previousGtkImageMenuItem
GtkImageMenuItem::get_imagenext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:58 2013 CEST