BR | EN

Home
What's it?
How to use?
Todo List
Download
Contact

What's it?

The phpGladeTool is a tool with a single objective, to help the php-gtk programmers on interface designing.
The screens of the system will be designed with Glade 2 and the phpGladeTool will generate the php-gtk2 code, based on XML file generated by Glade. Beyond the php-gtk code, a structure of business logic is generated, based on methods/event called by the interface(button clicks, etc);

The phpGladeTool is developed and tested using PHP5 and Glade2, the generated code is only compatible with the php-gtk2.



Basically the structure is:

<?php
// Class that contains only the code to interface
class phpGladeTool_Gtk
{
    protected $window1 = null;
    protected $button1 = null;
    
    protected function get_window1() {
        if ( $this->window1 == null ) {
            $this->window1 = new GtkWindow();
        }
        return $this->window1;
    }
    
    protected function get_button1() {
        if ( $this->button1 == null ) {
            $this->button1 = new GtkButton();
        }
        $this->button1->set_label("Close");
        $this->button1->connect_object("clicked", array($this,"shutdown"));
        return $this->button1;
    }
    
    protected function __construct() {        
        $this->get_window1()->add( $this->get_button1() );
        $this->get_window1()->show_all();
    }
}
?>



<?php
// Class that contais the business logic
class phpGladeTool extends phpGladeTool_Gtk
{
    public function __construct() {
        parent::__construct();
    }
    protected function shutdown() {
        Gtk::main_quit();
    }
}
new phpGladeTool();
Gtk::main();
?>

Webdesign: JM web templates