1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
# You may distribute under the terms of the GNU General Public License
#
# (C) Paul Evans, 2008-2014 -- leonerd@leonerd.org.uk
package Circle::Widget::Scroller;
use strict;
use warnings;
use base qw( Circle::Widget );
our $VERSION = '0.173320';
sub new
{
my $class = shift;
my %args = @_;
my $self = $class->SUPER::new( @_ );
$self->{scrollback} = $args{scrollback};
return $self;
}
sub push_event
{
my $self = shift;
my ( $event, $time, $args ) = @_;
my $eventqueue = $self->get_prop_displayevents;
my $overcount = @$eventqueue + 1 - $self->{scrollback};
$self->shift_prop_displayevents( $overcount ) if $overcount > 0;
$self->push_prop_displayevents( [ $event, $time, $args ] );
}
0x55AA;
|