PHP-GTK
Wednesday, July 23, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkRadioMenuItem
GtkRadioMenuItem Constructornext

Last updated: Sun, 12 May 2013
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: 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