<?php
dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so'));
function collect($d, $m, $y) {
echo $d->get_value_as_int(). "-" .$m->get_value_as_int().
"-" .$y->get_value_as_int()."\n";
flush();
}
$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_CENTER);
$window->connect_object('destroy', array('gtk', 'main_quit'));
$vbox = &new GtkVBox(false, 5);
$window->add($vbox);
$hbox = &new GtkHBox(false, 5);
$hbox->set_border_width(5);
$vbox->add($hbox);
$daylabel = &new GtkLabel("Day:");
$hbox->pack_start($daylabel, false);
$day = date("d");
$dayadj = &new GtkAdjustment($day, 1.0, 31.0, 1.0, 7.0, 0.0);
$dayspin = &new GtkSpinButton($dayadj);
$dayspin->set_wrap(true);
$hbox->pack_start($dayspin, false);
$monthlabel = &new GtkLabel("Month:");
$hbox->pack_start($monthlabel, false);
$month = date("m");
$monthadj = &new GtkAdjustment($month, 1.0, 12.0, 1.0, 3.0, 0.0);
$monthspin = &new GtkSpinButton($monthadj);
$monthspin->set_wrap(true);
$hbox->pack_start($monthspin, false);
$yearlabel = &new GtkLabel("Year:");
$hbox->pack_start($yearlabel, false);
$year = date("Y");
$yearadj = &new GtkAdjustment($year, $year-90, $year+10, 1.0, 5.0, 0.0);
$yearspin = &new GtkSpinButton($yearadj);
$yearspin->set_usize(55, 0);
$hbox->pack_start($yearspin, false);
$button = &new GtkButton("Collect data");
$button->connect_object('clicked', 'collect', $dayspin, $monthspin,
$yearspin);
$vbox->add($button);
$vbox->show_all();
$hbox->show_all();
$window->show_all();
gtk::main();
?>
|