The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Prima::Widget::Fader - fading- in/out functions

DESCRIPTION

The role implements fading effects in widgets

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 in effect

fader_prelight_color $COLOR [, $MULTIPLIER ]

Given a base $COLOR, increases (or decreases) its brightness according to fader_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 finishes 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 finishes 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>.

SEE ALSO

Prima::Widget