在 Gtk 中 用类 GtkStatusIcon 来创建一个系统托盘对象,以实现像 QQ 那样在 windows 桌面右下角显示 一个 小图标。这个类要求 Gtk 高于2.10 。在 www.kksou.com 上有关于这个类的一系列介绍: http://www.kksou.com/php-gtk2/articles/set-up-an-application-to-run-in-the-system-tray-using-GtkStatusIcon---Part-1.php 。
简单的使用实例:
---------------------------------------------------------------------------
// 创建对象
$aStatusIcon = new GtkStatusIcon() ;
// 加载一个图像文件
$aStatusIcon->set_from_file(ROOT_PATH.'Resource/Image/window.png') ;
// 鼠标移入的提示
$aStatusIcon->set_tooltip('Left click to PLAY') ;
// 让这个图标闪烁
$aStatusIcon->set_blinking(true) ;
// ... ...
// 停止闪烁
$aStatusIcon->set_blinking(false) ;
---------------------------------------------------------------------------------------------------------------
由于在 PHP-Gtk 的文档中没有找到相关的内容,下面是我通过 反射(reflect) 得到的 此类可响应的事件 和 类成员:
[事件]
“size-changed”: Callback ( gint ) return gboolean
“activate”: Callback () return void
“popup-menu”: Callback ( guint, guint ) return void
[类成员]
class GtkStatusIcon
{
const gtype = 148074248 ;
public function __construct( ){}
static public function new_from_pixbuf( GdkPixbuf $pixbuf ){}
static public function new_from_file( $filename ){}
static public function new_from_stock( $stock_id ){}
static public function new_from_icon_name( $icon_name ){}
public function get_blinking( ){}
public function get_geometry( ){}
public function get_icon_name( ){}
public function get_pixbuf( ){}
public function get_size( ){}
public function get_stock( ){}
public function get_storage_type( ){}
public function get_visible( ){}
public function is_embedded( ){}
static public function position_menu( GtkMenu $menu, GtkStatusIcon $statusicon ){}
public function set_blinking( $blinking ){}
public function set_from_file( $filename ){}
public function set_from_icon_name( $icon_name ){}
public function set_from_pixbuf( GdkPixbuf $pixbuf ){}
public function set_from_stock( $stock_id ){}
public function set_tooltip( $tooltip_text ){}
public function set_visible( $visible ){}
public function __tostring( ){}
public function connect( $signal, $callback, $userparam ){}
public function connect_after( $signal, $callback, $userparam ){}
public function connect_object( $signal, $callback, $userparam ){}
public function connect_object_after( $signal, $callback, $userparam ){}
public function connect_simple( $signal, $callback, $userparam ){}
public function connect_simple_after( $signal, $callback, $userparam ){}
public function notify( $property_name ){}
public function freeze_notify( ){}
public function thaw_notify( ){}
public function get_property( $property_name ){}
public function set_property( $property_name, $value ){}
public function get_data( $key ){}
public function set_data( $key, $value ){}
public function emit( ){}
public function block( $handler_id ){}
public function unblock( $handler_id ){}
public function disconnect( $handler_id ){}
public function is_connected( $handler_id ){}
static public function signal_query( $signal, $gtype ){}
public function stop_emission( $signal ){}
static public function signal_list_ids( $gtype ){}
static public function signal_list_names( $gtype ){}
public function emit_stop_by_name( $signal ){}
}
简单的使用实例:
---------------------------------------------------------------------------
// 创建对象
$aStatusIcon = new GtkStatusIcon() ;
// 加载一个图像文件
$aStatusIcon->set_from_file(ROOT_PATH.'Resource/Image/window.png') ;
// 鼠标移入的提示
$aStatusIcon->set_tooltip('Left click to PLAY') ;
// 让这个图标闪烁
$aStatusIcon->set_blinking(true) ;
// ... ...
// 停止闪烁
$aStatusIcon->set_blinking(false) ;
---------------------------------------------------------------------------------------------------------------
由于在 PHP-Gtk 的文档中没有找到相关的内容,下面是我通过 反射(reflect) 得到的 此类可响应的事件 和 类成员:
[事件]
“size-changed”: Callback ( gint ) return gboolean
“activate”: Callback () return void
“popup-menu”: Callback ( guint, guint ) return void
[类成员]
class GtkStatusIcon
{
const gtype = 148074248 ;
public function __construct( ){}
static public function new_from_pixbuf( GdkPixbuf $pixbuf ){}
static public function new_from_file( $filename ){}
static public function new_from_stock( $stock_id ){}
static public function new_from_icon_name( $icon_name ){}
public function get_blinking( ){}
public function get_geometry( ){}
public function get_icon_name( ){}
public function get_pixbuf( ){}
public function get_size( ){}
public function get_stock( ){}
public function get_storage_type( ){}
public function get_visible( ){}
public function is_embedded( ){}
static public function position_menu( GtkMenu $menu, GtkStatusIcon $statusicon ){}
public function set_blinking( $blinking ){}
public function set_from_file( $filename ){}
public function set_from_icon_name( $icon_name ){}
public function set_from_pixbuf( GdkPixbuf $pixbuf ){}
public function set_from_stock( $stock_id ){}
public function set_tooltip( $tooltip_text ){}
public function set_visible( $visible ){}
public function __tostring( ){}
public function connect( $signal, $callback, $userparam ){}
public function connect_after( $signal, $callback, $userparam ){}
public function connect_object( $signal, $callback, $userparam ){}
public function connect_object_after( $signal, $callback, $userparam ){}
public function connect_simple( $signal, $callback, $userparam ){}
public function connect_simple_after( $signal, $callback, $userparam ){}
public function notify( $property_name ){}
public function freeze_notify( ){}
public function thaw_notify( ){}
public function get_property( $property_name ){}
public function set_property( $property_name, $value ){}
public function get_data( $key ){}
public function set_data( $key, $value ){}
public function emit( ){}
public function block( $handler_id ){}
public function unblock( $handler_id ){}
public function disconnect( $handler_id ){}
public function is_connected( $handler_id ){}
static public function signal_query( $signal, $gtype ){}
public function stop_emission( $signal ){}
static public function signal_list_ids( $gtype ){}
static public function signal_list_names( $gtype ){}
public function emit_stop_by_name( $signal ){}
}
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/2227/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2009-11-16 21:37
评论列表