PHP-GTK: Splash窗口例子

王朝php·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

<?php

class splash {

var $gui = null;

var $times = null;

function splash() {

$this->gui = array(); // 初始化

$this->times = 0;

}

/**

* 运行主程序

*/

function run() {

$this->gui['splash'] = &new GtkWindow(GTK_WINDOW_POPUP);

$this->gui['splash']->set_position(GTK_WIN_POS_CENTER);

$this->gui['splash']->set_usize(365, 221);

$this->gui['vbox'] = &new GtkVbox(false, 0);

// load pixmap

list($pixmap, $mask) = Gdk::pixmap_create_from_xpm($this->gui['splash']->window, null, 'splash.xpm');

$splash = &new GtkPixmap($pixmap, $mask);

// add the image to the box

$this->gui['vbox']->add($splash);

// load loading label

$this->gui['loading'] = &new GtkLabel();

// add the loading label to the box

$this->gui['vbox']->add($this->gui['loading']);

// add the box to the window

$this->gui['splash']->add($this->gui['vbox']);

$this->gui['splash']->show_all();

$this->loading();

Gtk::main();

}

/**

* Loging ...

*/

function loading() {

$this->times ++;

$this->gui['loading']->set_text('Loading .' . str_repeat('.', $this->times));

// 刷新屏幕

while (gtk::events_pending()) gtk::main_iteration();

$loadingid = Gtk::timeout_add(1000, array(&$this, 'loading'));

// 运行4次退出

if($this->times > 4) {

Gtk::main_quit();

Gtk::timeout_remove($loadingid);

}

}

}

$splash = &new splash();

$splash->run();

?>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航