NAME
Wx::Perl::Throbber - An animated throbber/spinner
SYNOPSIS
use Wx::Perl::Throbber;
my @frames;
foreach ('1.gif', '2.gif', '3.gif') {
push @frames, new Wx::Bitmap($_, wxBITMAP_TYPE_ANY);
}
my $throbber = new Wx::Perl::Throbber($parent, -1, \@frames, $pos, $size);
$throbber->SetLabel('Please Wait');
$throbber->ShowLabel(1);
$throbber->Start();
...
$throbber->Rest(); # or Stop()
DESCRIPTION
This control is based on the Python library wx.throbber.
A throbber displays an animated image that can be started, stopped, reversed, etc. Useful for showing an ongoing process (like most web browsers use) or simply for adding eye-candy to an application.
Throbbers utilize a Wx::Timer so that normal processing can continue unencumbered.
METHODS
- $throbber = new($parent, $id, $bitmap, $position, $size, $frameDelay, $frames, $framesWidth, $label, $overlay, $reverse, $style, $name)
-
$parent (parent window) $id = -1 (window identifier) $bitmap = undef (throbber bitmap. see SetBitmap()) $position = wxDefaultPosition (window position) $size = wxDefaultSize (window size) $frameDelay = 75 (milliseconds. See SetFrameDelay) $frames = undef (number of frames. see SetBitmap()) $framesWidth = undef (width of frames. see SetBitmap()) $label = '' (text label. see SetLabel()) $overlay = undef (overlay bitmap. see SetOverlay()) $reverse = 0 (auto-reverse) $style = undef (window style) $name = "throbber" (window name)
- SetBitmap($bitmap, $frames, $framesWidth)
-
$bitmap
is either a singleWx::Bitmap
that will be split into frames (a composite image) or a list ofWx::Bitmap
objects that will be treated as individual frames.If a single (composite) image is given, then additional information must be provided: the number of frames in the image (
$frames
) and the width of each frame ($framesWidth
).The first frame is treated as the "at rest" frame (it is not shown during animation, but only when
Rest()
is called. - SetFrameDelay($milliseconds)
-
Set the delay between frames in milliseconds
Default is 75 milliseconds
- GetFrameDelay()
-
Returns the frame delay
- Start()
-
Start the animation
- Stop()
-
Stop the animation
- Rest()
-
Stop the animation and return to the rest frame (frame 0)
- IsRunning()
-
Returns
true
if the animation is running - GetCurrentFrame()
-
Returns the frame index that is currently displayed. Starts at 0 (the rest frame)
- GetFrameCount()
-
Returns the number of frames in the animation (excluding the rest frame)
- Reverse()
-
Change the direction of the animation
- SetAutoReverse($bool)
-
Turn on/off auto-reverse. When auto-reverse is set, the throbber will change direction when it reaches the start/end of the animation. Otherwise it jumps back to the beginning.
- GetAutoReverse()
-
Get the auto-reverse state
- SetOverlay($bitmap)
-
Sets an overlay bitmap to be displayed above the throbber animation
- GetOverlay()
-
Returns a copy of the overlay bitmap set for the throbber
- ShowOverlay($state)
-
Set true/false whether the overlay bitmap is shown
- SetLabel($label)
-
Set the text of the label. The text label appears above the throbber animation and overlay (if applicable)
- GetLabel()
-
Returns the label set for the throbber
- ShowLabel($state)
-
Set true/false whether the text label is shown
- SetFont ($font)
-
Set the font for the label. Expects a Wx::Font object.
EVENTS
- EVT_UPDATE_THROBBER($throbber, \&func)
-
This event is processed while the throbber is running, every $frameDelay milliseconds
This function is exported on request:
use Wx::Perl::Throbber 'EVT_UPDATE_THROBBER';
AUTHOR
Simon Flack
COPYRIGHT
This module is released under the wxWindows/GPL license
ACKNOWLEDGEMENTS
Wx::Perl::Throbber is based on the Python library wx.throbber by Cliff Wells