Index: pm/SimpleList.pm =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/pm/SimpleList.pm,v retrieving revision 1.23 diff -u -d -r1.23 SimpleList.pm --- pm/SimpleList.pm 28 Mar 2004 22:52:29 -0000 1.23 +++ pm/SimpleList.pm 5 Apr 2004 19:23:13 -0000 @@ -7,6 +7,7 @@ use strict; use Carp; +use Glib qw(TRUE FALSE); use Gtk2; our @ISA = 'Gtk2::TreeView'; @@ -216,6 +217,40 @@ return $self->{data}->[$index]; } +sub row_visible +{ + my ($self, $index) = @_; + + my $path = Gtk2::TreePath->new_from_indices ($index); + my $column = $self->get_column (0); + + my $rectangle = $self->get_cell_area ($path, $column); + my ($y, $height) = ($rectangle->y, $rectangle->height); + + if (0 > $y + $height) { + return FALSE; + } + + my $parent = $self->parent; + + if (UNIVERSAL::isa ($parent, "Gtk2::Viewport")) { + croak ("row_visible does not work with Gtk2::SimpleLists that " . + "are insinde Gtk2::Viewports"); + } + + if (UNIVERSAL::isa ($parent, "Gtk2::ScrolledWindow")) { + my $page_size = $parent->get_vadjustment->get ("page-size"); + if ($y > $page_size) { + return FALSE; + } + } + + # if the list is not inside a scrolled window or a viewport, all rows + # will always be visible. + + return TRUE; +} + ################################## package Gtk2::SimpleList::TiedRow;