[Perl Module] Perl的GTK2的Gtk2::ListStore和Gtk2::IconView配合使用的小例子

Oct 1st, 2009

转载本站文章请注明,转载自:扶凯[http://www.php-oa.com]

本文链接: http://www.php-oa.com/2009/10/01/perl-gtk2-gtk2liststore-gtk2iconview.html

 Perl的GTK2的Gtk2::ListStore和Gtk2::IconView配合使用的小例子….不细写..

#!/usr/bin/perl
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';
use Gtk2::GladeXML;
use strict;

use constant C_Str               => 0;
use constant C_Col               => 1;
use constant C_Pix               => 2;

my $gladexml = Gtk2::GladeXML->new("gui.glade","dlgOptions");
$gladexml->signal_autoconnect_from_package('main');

my $win = $gladexml->get_widget('dlgOptions');
my $icon_view = $gladexml->get_widget('ivTabs');

my $tree_model = create_iconview_model();
$icon_view->set_model($tree_model);

$icon_view->set_markup_column(C_Str);
$icon_view->set_columns(C_Col);
$icon_view->set_pixbuf_column(C_Pix);

sub create_iconview_model {
    my $list_store = Gtk2::ListStore->new(qw/Glib::String Glib::Int Gtk2::Gdk::Pixbuf/);
    my $iter = $list_store->append;
    $list_store->set (
                $iter,
                C_Str, "<b>General</b>",
                C_Col, 1,
                C_Pix, Gtk2::Gdk::Pixbuf->new_from_file("rdp.png"),
     );

return $list_store;

}

$win->show();

Gtk2->main;
Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪 ViVi 365Key 网摘 天极网摘 和讯网摘 博拉网 POCO 网摘 饭否 QQ 书签 Digbuzz 我挖网 Mister Wong
Tags:
No comments yet.