#
# $Id: CardUndo.pm,v 4.6 1999/06/14 05:13:13 kono Exp $
#
package CardPlay::CardUndo;

use strict;

use vars qw($VERSION @ISA @EXPORT @EXPORT_OK
);

require Exporter;
require AutoLoader;

@ISA = qw(Exporter AutoLoader);

@EXPORT = qw( );

$VERSION = "0.2";

use Tk;
use Carp;

# class method

sub new {
    my ($types) = shift;
    my $self;

    %{$self} = @_;
    bless $self;
}

# instance method

sub print {
    my ($self) = @_;
    my ($card);
    print STDERR "card ",$self->{'-mode'},":";
    if ( defined ($card = $self->{'-card'})) {
	print STDERR $card->{'-suit'}, $card->{'-number'},"\n";
    }
}

sub undo {
    my ($self) = @_;
    if ($self->{'-mode'} eq 'open') {
	$self->{'-card'}->hide();
    } else {
	$self->{'-card'}->open();
    }
}

sub redo {
    my ($self) = @_;
    if ($self->{'-mode'} eq 'open') {
	$self->{'-card'}->open();
    } else {
	$self->{'-card'}->hide();
    }
}

1;
# end
