<?php
class Test {
public function test(){
$dialog = new GtkMessageDialog($wnd, Gtk::DIALOG_MODAL, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
$dialog->set_markup("coucou" );
$dialog->run();
$dialog->destroy();
}
public function __construct(){
$this->start();
}
public function start(){
$this->checkGTK();
$this->initGUI();
Gtk::main();
}
public function initGUI(){
// Fenêtre
$window = new GtkWindow();
$window->set_border_width(5);
$window->set_title("Test" );
$window->set_default_size(400, 50);
$TestButton = new GtkButton("Clique moi" );
$TestButton->connect_simple('clicked', 'test');
$window->add($TestButton);
// Affichage
$window->show_all(); }
public function checkGTK(){
if (!class_exists('gtk')) {
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') dl('php_gtk.dll');
else dl('php_gtk.so');
}
}
}
?> |