Gtk2-Ex-Dragger

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

debian/control
debian/copyright
debian/rules
debian/source/format
debian/watch
devel/layout.pl
devel/run.pl
devel/viewport.pl
examples/builder-internal.pl
examples/builder.pl
examples/busy.pl
examples/heart.pl
examples/label.pl
examples/layout.pl
examples/textview.pl
examples/vruler.pl
inc/my_pod2html
inc/MyMakeMakerExtras.pm
lib/Gtk2/Ex/Dragger.pm
Makefile.PL
MANIFEST			This list of files

SIGNATURE  view on Meta::CPAN

SHA1 b1b3f9033d00ff62a1e1dd328aba561f6323feb1 debian/control
SHA1 7e3c225fa4a2bb99af4611126181a1e4a690a73b debian/copyright
SHA1 a900deb0f6cdbdd62a2899a36accd06fd63d2e58 debian/rules
SHA1 61652cd1568dcf2614df833eba241755eee34e89 debian/source/format
SHA1 1b06fb6650633b109153ad4148d11a48a5713a93 debian/watch
SHA1 4738eeff5e687e32760e1b618bdd04bfdf4b2b0a devel/layout.pl
SHA1 5cd5627de3dda79eefab1abb11bb426d51b45a2c devel/run.pl
SHA1 9db026ec35c7d96f61cc9f778ac4176c6271077a devel/viewport.pl
SHA1 754b5934e35128d94cbf2854ed85998a81f221dc examples/builder-internal.pl
SHA1 ac1d6b9151286c7efe7208f6d64774eb435174d1 examples/builder.pl
SHA1 82c5374ba0df21b4422d56d9c3a3ac436e77f317 examples/busy.pl
SHA1 1c43b33bbea4f434bede35164a19ba6ef1dadca2 examples/heart.pl
SHA1 399db15843931eac5bf628730f472ca766703f6c examples/label.pl
SHA1 049d073f5661a47cad8376f116e4839f93704fd1 examples/layout.pl
SHA1 1c4fd7b7819af1ca2bc2fb71470b26b355c677ba examples/textview.pl
SHA1 fc0e94aa155747d0f7bb98c80df04fb4ab458dd2 examples/vruler.pl
SHA1 8acf373cf4ab742c7601dda8afb49225c6c63a77 inc/MyMakeMakerExtras.pm
SHA1 7a988b2aa7ed09f1cb9029a1ef3f0e2139dca0cf inc/my_pod2html
SHA1 27457d71eadb8f20b27925115258e1e6f82b7c93 lib/Gtk2/Ex/Dragger.pm
SHA1 75574951553deb4956137f3b5120b636dee047bc t/Dragger-load.t
SHA1 f9d40863895229fc335150752666c66fb6e233dc t/Dragger.t

examples/busy.pl  view on Meta::CPAN

#
# Gtk2-Ex-Dragger 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 Gtk2-Ex-Dragger.  If not, see <http://www.gnu.org/licenses/>.


# This example shows the interaction between the WidgetCursor "busy"
# mechanism and a Dragger.
#
# Basically the busy cursor is shown, but the Dragger state isn't lost and
# the cursor is restored when unbusy - which is pretty much what you want if
# a scroll provokes some time consuming activity.
#
# As noted in the text below, if you keep wiggling the mouse around the busy
# cursor will continue to show.  That's because it's only removed when idle,
# and the main loop activity you create by wiggling means it's not idle yet.
# This is logical, and you do normally want the busy cursor to stay while
# doing drawing for such wiggling, even if in this case the program is
# interacting and therefore from the user's point of view not really busy.
#

use 5.008;
use strict;
use warnings;
use Time::HiRes;
use Glib 1.220;
use Gtk2 1.220 '-init';
use Gtk2::Ex::WidgetCursor;
use Gtk2::Ex::Dragger;

examples/busy.pl  view on Meta::CPAN

  ("
Drag
with
mouse
button-1
to move
this
up and
down.
The
busy
indication
comes and
goes on
a timer
and if
you
keep
moving
the
mouse
you can
extend
the
busy
since
it doesn't
get
back to
idle
state
to be
turned
off.
");

examples/busy.pl  view on Meta::CPAN

     my ($viewport, $event) = @_;
     if ($event->button == 1) {
       $dragger->start ($event);
       return Gtk2::EVENT_STOP;
     } else {
       return Gtk2::EVENT_PROPAGATE;
     }
   });


sub busy {
  Gtk2::Ex::WidgetCursor->busy;
  Time::HiRes::usleep (400_000);   # 400 milliseconds
  return Glib::SOURCE_CONTINUE;
}
Glib::Timeout->add (1200, \&busy);  # 800 milliseconds

$toplevel->show_all;
Gtk2->main;
exit 0;

lib/Gtk2/Ex/Dragger.pm  view on Meta::CPAN

of the total adjustable extent.

The "confine" option lets you to restrict mouse movement to screen positions
corresponding to the adjustment upper/lower, so the user gets an obvious
feedback at the limits.

The "cursor" option changes the mouse pointer cursor while dragging.  This
is good if it's not clear for a given widget which button press etc
activates a drag.  The cursor is set through WidgetCursor (see
L<Gtk2::Ex::WidgetCursor>) and so cooperates with other uses of that.  See
F<examples/heart.pl> in the Gtk2-Ex-Dragger sources, or F<examples/busy.pl>
for the global "busy" indication.

Dragger can work on both natively scrollable widgets and widgets put into a
C<Gtk2::Viewport>.  For a viewport it's the viewport widget which is passed
to the dragger since that's the widget showing a portion of a larger
underlying thing.  (Eg. F<examples/textview.pl> natively or
F<examples/label.pl> and F<examples/layout.pl> in a Viewport or Layout, and
F<examples/vruler.pl> with separately jigged up adjusters.)

Changes to the adjustment value, upper/lower, page size, or the widget
window size are all allowed during a drag.  A change to the value could come



( run in 0.620 second using v1.01-cache-2.11-cpan-87723dcf8b7 )