Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / blib / lib / Wx / Timer.pm
1 #############################################################################
2 ## Name:        lib/Wx/Timer.pm
3 ## Purpose:     Wx::Timer and Wx::TimerRunner
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     14/02/2001
7 ## RCS-ID:      $Id: Timer.pm 2057 2007-06-18 23:03:00Z mbarbon $
8 ## Copyright:   (c) 2001-2002 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 package Wx::Timer;
14
15 use strict;
16
17 sub new {
18   my $class = shift;
19
20   @_ == 0                              && return Wx::Timer::newDefault( $class, );
21   Wx::_match( @_, $Wx::_wehd_n, 1, 1 ) && return Wx::Timer::newEH( $class, @_ );
22   Wx::_croak Wx::_ovl_error;
23 }
24
25 package Wx::TimerRunner;
26
27 use strict;
28
29 sub new {
30   my $class = shift;
31   my $this = { TIMER => shift };
32
33   if( @_ > 0 ) { $this->{TIMER}->Start( @_ ) }
34
35   bless $this, $class;
36
37   $this;
38 }
39
40 sub DESTROY {
41   my $this = shift;
42
43   $this->{TIMER}->Stop if $this->{TIMER}->IsRunning;
44 }
45
46 sub Start {
47   my( $this, $milliseconds, $oneshot ) = @_;
48
49   $this->{TIMER}->Start( $milliseconds, $oneshot );
50 }
51
52 1;
53
54 # Local variables: #
55 # mode: cperl #
56 # End: #