App-Chart

 view release on metacpan or  search on metacpan

lib/App/Chart/Gtk2/Ex/ListStore/DragByCopy.pm  view on Meta::CPAN

  ### yes
  return 1;
}

1;
__END__

=head1 NAME

App::Chart::Gtk2::Ex::ListStore::DragByCopy -- drag and drop copying between ListStores

=head1 SYNOPSIS

 package MyStore;
 use Gtk2;
 use base 'App::Chart::Gtk2::Ex::ListStore::DragByCopy';
 use Glib::Object::Subclass
   'Gtk2::ListStore',
   interfaces => [ 'Gtk2::TreeDragSource',
                   'Gtk2::TreeDragDest' ];

=head1 DESCRIPTION

C<App::Chart::Gtk2::Ex::ListStore::DragByCopy> is designed as a
multi-inheritance mix-in for Perl sub-classes of C<Gtk2::ListStore>.  It
provides versions of the following methods which allow drag-and-drop between
different models.

    ROW_DRAGGABLE
    DRAG_DATA_GET
    DRAG_DATA_DELETE

    ROW_DROP_POSSIBLE
    DRAG_DATA_RECEIVED

Normally ListStore restricts drag and drop to re-ordering rows within a
single model.  With this mix-in rows can be copied to or from any compatible
model, though still only within the same running program.

=head1 FUNCTIONS

=over 4

=item C<< $bool = ROW_DRAGGABLE ($liststore, $src_path) >>

=item C<< $bool = DRAG_DATA_GET ($liststore, $src_path, $selection) >>

=item C<< $bool = DRAG_DATA_DELETE ($liststore, $src_path) >>

The drag methods offer a row as data and delete it with C<remove> when
dragged.

If you want to impose extra conditions on dragging you can write your own
versions of these functions and chain up.  For example if only the first
three rows of the model are draggable then

    sub ROW_DRAGGABLE {
      my ($self, $path) = @_;
      my ($index) = $path->get_indices;
      if ($index >= 3) { return 0; } # not draggable
      return $self->SUPER::ROW_DRAGGABLE ($path);
    }

=item C<< $bool = ROW_DROP_POSSIBLE ($liststore, $dst_path, $selection) >>

=item C<< $bool = DRAG_DATA_RECEIVED ($self, $dst_path, $selection) >>

The drop methods accept a row from any TreeModel.  They get the row data
with C<< $src->get >> and store it with C<< $dst->insert_with_values >>.

=back

=head1 SEE ALSO

L<Gtk2::ListStore>

=cut



( run in 0.675 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )