PHP-GTK
Tuesday, February 14, 2012 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkRadioMenuItem
GtkRadioMenuItem Constructornext

Last updated: Tue, 14 Feb 2012
view this page in English

GtkRadioMenuItem Constructor

GtkRadioMenuItem ([GtkRadioMenuItem group [, string text [, bool use_underline = true]]]);

Creates a new radio menu item. The group is the menu item to which group the new item belongs. Set it to null if you are creating the first radio menu item of the group.

Example 108. Creating GtkRadioMenuItems

<?php
//Create a menu bar
$mbar  = new GtkMenuBar();
//Add a menu item
$color  = new GtkMenuItem('_Color');
//with a submenu
$cmenu = new GtkMenu();
$color->set_submenu($cmenu);
$mbar->add($color);
 
 
//Create a new radio menu item; no group
$red   = new GtkRadioMenuItem(null, '_Red', true);
//Here another one, this time using the $red as group
$blue  = new GtkRadioMenuItem($red, '_Blue', true);
//Again: Same group as the previous, $red
$green = new GtkRadioMenuItem($red, '_Green', true);
 
//Add the items to the menu
$cmenu->add($red);
$cmenu->add($blue);
$cmenu->add($green);
 
//Set the red item pre-selected
$red->set_active(true);
 
 
//set some colors to be able to identify the colors
// without reading the text
$red  ->get_child()->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse('#F00'));
$blue ->get_child()->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse('#00F'));
$green->get_child()->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse('#0F0'));
 
 
//standard window stuff
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$wnd->add($mbar);
$wnd->show_all();
Gtk::main();
?>

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


previousGtkRadioMenuItem
GtkRadioMenuItem Constructornext

Last updated: Tue, 14 Feb 2012
view this page in English


credits 

PHP  Copyright © 2001-2012 The PHP Group
 All rights reserved.
Last updated: Tue Feb 14 02:45:58 2012 UTC