PHP-GTK
Sunday, December 21, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkMenuBar
GtkMenuItemnext

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

GtkMenuBar Constructor

Use the constructor to create a new GtkMenuBar widget and then add GtkMenuItems to it.

This widget is a subclass of GtkMenuShell, hence all methods that can be applied to GtkMenuShell may be used here.

Example 101. Creating a simple menu bar

<?php
//Create a simple menu bar
$menubar = new GtkMenuBar();
 
//Add File menu item with a dropdown menu
$file = new GtkMenuItem('_File');
$menubar->append($file);
 
//Quit item
$quit = new GtkMenuItem('_Quit');
 
//This menu will popup when the File menu is activated
$mnuFile = new GtkMenu();
//Add the Quit item to the File popup menu
$mnuFile->append($quit);
 
//Set the popupmenu of the File menu item
$file->set_submenu($mnuFile);
 
 
//another menu item
$edit = new GtkMenuItem('_Edit');
$menubar->append($edit);
 
 
//Add the menu bar to the window
$wnd = new GtkWindow();
$wnd->add($menubar);
 
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
$wnd->show_all();
Gtk::main();
?>

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


previousGtkMenuBar
GtkMenuItemnext

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:59 2013 CEST