rendered paste body<?php
class splash extends GtkWindow {
protected $steps = array();
protected $step = 1;
protected $label;
protected $progressbar;
public function __construct(){
parent::__construct();
$this->set_position(Gtk::WIN_POS_CENTER);
$this->set_resizable(false);
$this->set_decorated(false);
$this->set_skip_taskbar_hint(true);
$this->set_skip_pager_hint(true);
$this->set_type_hint(Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN);
$this->label = new gtklabel();
$this->label->set_text("Starting Application");
$this->progressbar = new gtkprogressbar();
$vbox = new gtkvbox();
$vbox->pack_end($this->label,false);
$vbox->pack_end($this->progressbar,false);
$this->add($vbox);
}
public function set_image($location){
$pixbuf = GdkPixbuf::new_from_file($location);
list($pixmap, $mask) = $pixbuf->render_pixmap_and_mask();
list($width, $height) = $pixmap->get_size();
$this->set_app_paintable(true);
$this->set_size_request($width, $height);
$this->realize();
if($mask instanceof GdkPixmap){
$this->shape_combine_mask($mask, 0, 0);
}
$this->window->set_back_pixmap($pixmap, false);
}
public function set_steps($steps){
$this->steps = $steps;
}
public function set_step($step){
if($step <= count($this->steps)){
$this->step = $step;
$this->label->set_text($this->steps[$this->step - 1]);
$this->progressbar->set_fraction($this->step / count($this->steps));
while(Gtk::events_pending()) Gtk::main_iteration();
}
}
public function next_step(){
if($this->step <= count($this->steps)){
$this->step++;
$this->label->set_text($this->steps[$this->step - 1]);
$this->progressbar->set_fraction($this->step / count($this->steps));
while(Gtk::events_pending()) Gtk::main_iteration();
}
}
}
?>