<?php
if (!extension_loaded('php-gtk')) {
dl('php_gtk.' . PHP_SHLIB_SUFFIX);
}
$w = &new GtkWindow;
$w->set_title('GtkPieMenu Example');
$w->set_border_width(20);
$w->connect_object('destroy', array('Gtk','main_quit'));
$piemenu = &new GtkPieMenu;
$button = &new GtkButton('Press button to activate PieMenu');
$button->connect('button_press_event', 'activate_pie_menu', $piemenu);
$w->add($button);
foreach (array('North', 'East', 'South', 'West') as $d) {
$m = &new GtkMenuItem($d);
$m->connect_object('activate', 'menu_callback', $d);
$piemenu->append($m);
}
$piemenu->show_all();
$w->show_all();
Gtk::main();
function activate_pie_menu($w, $e, $piemenu) {
$piemenu->popup($e->button, $e->time);
}
function menu_callback($b) {
echo "'$b' button pressed\n";
}
?>