NAME
Prima::Widget::Fader
DESCRIPTION
Fading- in/out functions
SYNOPSIS
use base qw(Prima::Widget Prima::Widget::Fader);
{
my %RNT = (
%{Prima::Widget-> notification_types()},
%{Prima::Widget::Fader-> notification_types()},
);
sub notification_types { return \%RNT; }
}
sub on_mouseenter { shift-> fader_in_mouse_enter }
sub on_mouseleave { shift-> fader_out_mouse_leave }
sub on_paint
{
my ( $self, $canvas ) = @_;
$canvas->backColor( $self-> fader_prelight_color( $self-> hiliteBackColor ));
$canvas->clear;
}
API
The API is currently under design so the parts that are documented are those that expected to be staying intact.
Methods
- fader_in_mouse_enter
-
Initiates a fade-in transition, calls repaint on each step.
- fader_out_mouse_leave
-
Initiates a fade-out transition, calls repaint on each step.
- fader_current_value
-
Returns the current fader value in the range from 0 to 1. Returns
undef
if there is no current fading transition running - fader_prelight_color $COLOR [, $MULTIPLIER ]
-
Given a base
$COLOR
, increases (or decreases) its brightness according tofader_current_value
, and an eventual$MULTIPLIER
that is expected to be in the range from 0 to 1.
Events
- FadeIn $ENDS_OK
-
Called when
fader_in_mouse_enter
is finished the fading, the$ENDS_OK
flag is set to 0 if the process was overridden by another fader call, 1 otherwise. - FadeOut $ENDS_OK
-
Called when
fader_out_mouse_leave
is finished the fading, the$ENDS_OK
flag is set to 0 if the process was overridden by another fader call, 1 otherwise. - FadeRepaint
-
By default repaints the whole widget, but can be overloaded if only some widget parts need to reflect the fader effect.
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.