######################################################################
# MessageDialog.pm
######################################################################
# Perl Power! - Michael Schilli 1998
######################################################################

###
### Message dialog widget class
###
package MessageDialog;

use Tk;
use strict;

###
### $md = MessageDialog->new($topwindow) - new message dialog
###
sub new {
    my($type, $parentwin) = @_;

    my $self = {};
                                            
    $self->{'parentwin'}   = $parentwin;

    bless($self, $type);
}

###
### $md->start("Title", "MessageText") - display message dialog
###
sub start {
    my $self     = shift;
    my $title    = shift;
    my $message  = shift;

    $self->{'topwin'} = $self->{'parentwin'}->Toplevel();

    $self->{'topwin'}->configure(-title => "$title");

    $self->{'topwin'}->Message(-text => "$message",
                               -width => "10c")->pack();
    $self->{'topwin'}->Button(-text => "OK", 
      -command => sub { $self->{'topwin'}->destroy() } 
                             )->pack();
}
    
1;

