Skip to content

Instantly share code, notes, and snippets.

@bobmagicii
Created March 19, 2012 20:06
Show Gist options
  • Save bobmagicii/2126256 to your computer and use it in GitHub Desktop.
Save bobmagicii/2126256 to your computer and use it in GitHub Desktop.
gtkassistant
<?php
class test extends GtkAssistant {
public $entry;
public $view;
public function __construct() {
parent::__construct();
// pages
for($a = 0; $a < 4; $a++) {
$box = new GtkVBox;
switch($a) {
case 0: {
$box->pack_start($this->entry = new GtkEntry);
break;
}
case 1: {
$box->pack_start($this->view = new GtkLabel('zomg'));
break;
}
default: {
$box->pack_start(new GtkLabel("derp #{$a}"));
break;
}
}
$this->append_page($box);
$this->set_page_title($box,"herp #{$a}");
$this->set_page_complete($box,true);
// don't forget to mark an end to the chain...
if($a == 3) $this->set_page_type($box,Gtk::ASSISTANT_PAGE_CONFIRM);
unset($box);
}
// signals
$this->connect_simple('delete-event',array('Gtk','main_quit'));
$this->connect_simple('apply',array('Gtk','main_quit'));
$this->connect_simple('cancel',array('Gtk','main_quit'));
$this->connect_simple('prepare',array($this,'onPrepare'));
// stuff
$this->set_size_request(400,300);
$this->set_border_width(6);
$this->show_all();
return;
}
public function onPrepare() {
//. recall this is 0 index.
switch($this->get_current_page()) {
case 1: {
$this->view->set_text($this->entry->get_text());
break;
}
}
return;
}
}
new test;
Gtk::main();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment