Glib-Ex-ConnectProperties
view release on metacpan or search on metacpan
lib/Glib/Ex/ConnectProperties/Element/tree_selection.pm view on Meta::CPAN
# 'selected-iter' => 'select_iter',
# tree-selection#selected-iter Gtk2::TreeIter or undef
=for stopwords Glib-Ex-ConnectProperties ConnectProperties TreeSelection synchronise TreeViews IconView selected-iter Gtk Ryde Perl-Gtk2's
=head1 NAME
Glib::Ex::ConnectProperties::Element::tree_selection -- TreeSelection rows
=for test_synopsis my ($treesel,$another);
=head1 SYNOPSIS
Glib::Ex::ConnectProperties->new([$treesel, 'tree-selection#width'],
[$another, 'something']);
=head1 DESCRIPTION
This element class implements ConnectProperties access to rows selected in a
L<Gtk2::TreeSelection>.
tree-selection#empty boolean, read-only
tree-selection#not-empty boolean, read-only
tree-selection#count integer, read-only
tree-selection#selected-path Gtk2::TreePath or undef
A C<Gtk2::TreeSelection> is normally used by C<Gtk2::TreeView>. The target
object for ConnectProperties should be the TreeSelection, as obtained from
the TreeView with
$treeselection = $treeview->get_selection();
For example C<tree-selection#not-empty> might be connected up to make a
delete button sensitive only when the user has selected one or more rows,
my $treeselection = $treeview->get_selection;
Glib::Ex::ConnectProperties->new
([$treeselection, 'tree-selection#not-empty'],
[$button, 'sensitive', write_only => 1]);
C<tree-selection#selected-path> is the first selected row. It's intended
for use with "single" selection mode so there's at most one row selected.
Writing to the property does C<select_path()> and in single mode will switch
from any existing selected row to just the new one. This could be used to
synchronise the selected item in two TreeViews.
Rows in a C<Gtk2::TreeSelection> and items in a C<Gtk2::IconView> are
similar but not quite the same and so are kept as separate
C<tree-selection#> and C<iconview-selection#>.
For reference a C<selected-iter> of type C<Gtk2::TreeIter> might mostly
work, but not sure about comparing on storing. Would prefer an C<equal()>
or C<compare()> method on C<Gtk2::TreeIter> rather than going via the model.
(Perl-Gtk2's C<to_arrayref()> access only suits Perl code models.)
=head1 SEE ALSO
L<Glib::Ex::ConnectProperties>,
L<Glib::Ex::ConnectProperties::Element::iconview_selection>,
L<Glib::Ex::ConnectProperties::Element::model_rows>,
L<Glib::Ex::ConnectProperties::Element::combobox_active>,
L<Gtk2::TreeSelection>,
L<Gtk2::TreeView>,
L<Gtk2::TreePath>
=head1 HOME PAGE
L<http://user42.tuxfamily.org/glib-ex-connectproperties/index.html>
=head1 LICENSE
Copyright 2010, 2011, 2012 Kevin Ryde
Glib-Ex-ConnectProperties is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option) any
later version.
Glib-Ex-ConnectProperties is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with
Glib-Ex-ConnectProperties. If not, see L<http://www.gnu.org/licenses/>.
=cut
( run in 1.064 second using v1.01-cache-2.11-cpan-8dfa8b56332 )