Gtk2::SimpleList

Gtk2::SimpleList is a simple interface to Gtk2's complex MVC list widget.
Download

Gtk2::SimpleList Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • muppet, Ross McFarland and Gavin Brown
  • Publisher web site:
  • http://search.cpan.org/~rmcfarla/Gtk2-Ex-Simple-List-0.50/lib/Gtk2/Ex/Simple/List.pm

Gtk2::SimpleList Tags


Gtk2::SimpleList Description

Gtk2::SimpleList is a simple interface to Gtk2's complex MVC list widget. Gtk2::SimpleList is a simple interface to Gtk2's complex MVC list widget.SYNOPSIS use Glib qw(TRUE FALSE); use Gtk2 '-init'; use Gtk2::SimpleList; my $slist = Gtk2::SimpleList->new ( 'Text Field' => 'text', 'Markup Field' => 'markup', 'Int Field' => 'int', 'Double Field' => 'double', 'Bool Field' => 'bool', 'Scalar Field' => 'scalar', 'Pixbuf Field' => 'pixbuf', ); @{$slist->{data}} = ( , , ); # (almost) anything you can do to an array you can do to # $slist->{data} which is an array reference tied to the list model push @{$slist->{data}}, ; # mess with selections $slist->get_selection->set_mode ('multiple'); $slist->get_selection->unselect_all; $slist->select (1, 3, 5..9); # select rows by index $slist->unselect (3, 8); # unselect rows by index @sel = $slist->get_selected_indices; # simple way to make text columns editable $slist->set_column_editable ($col_num, TRUE); # Gtk2::SimpleList derives from Gtk2::TreeView, so all methods # on a treeview are available. $slist->set_rules_hint (TRUE); $slist->signal_connect (row_activated => sub { my ($sl, $path, $column) = @_; my $row_ref = $sl->get_row_data_from_path ($path); # $row_ref is now an array ref to the double-clicked row's data. }); # turn an existing TreeView into a SimpleList; useful for # Glade-generated interfaces. $simplelist = Gtk2::SimpleList->new_from_treeview ( $glade->get_widget ('treeview'), 'Text Field' => 'text', 'Int Field' => 'int', 'Double Field' => 'double', );ABSTRACTSimpleList is a simple interface to the powerful but complex Gtk2::TreeView and Gtk2::ListStore combination, implementing using tied arrays to make thing simple and easy.Gtk2 has a powerful, but complex MVC (Model, View, Controller) system used to implement list and tree widgets. Gtk2::SimpleList automates the complex setup work and allows you to treat the list model as a more natural list of lists structure.After creating a new Gtk2::SimpleList object with the desired columns you may set the list data with a simple Perl array assignment. Rows may be added or deleted with all of the normal array operations. You can treat the data member of the list simplelist object as an array reference, and manipulate the list data with perl's normal array operators.A mechanism has also been put into place allowing columns to be Perl scalars. The scalar is converted to text through Perl's normal mechanisms and then displayed in the list. This same mechanism can be expanded by defining arbitrary new column types before calling the new function. Requirements: · Perl


Gtk2::SimpleList Related Software