package Perlbox::perlboxTK::pDialog::pDialog;
use Tk;
use strict;

use vars qw( $VERSION @ISA) ;

$VERSION = '0.1.x' ;

require Tk::Toplevel ;

@ISA = qw( Tk::Toplevel ) ;

Construct Tk::Widget 'pDialog' ;

   my $mw;
   my ($textVar, $titleVar);
   my $returnVal;
   return 1;


sub Populate(){

       my $args;
       ($mw, $args) = @_;
        $mw->SUPER::Populate($args);
	$textVar = delete $args->{"-text"};
        $titleVar= delete $args->{"-title"};
        $mw->protocol( 'WM_DELETE_WINDOW' => sub { } ) ;
        $mw->transient( $mw->toplevel ) ;

}

sub Show(){
	#construct the size of our widget
	my $ht=150;

	$mw->geometry("200x".$ht."+10+10");
        $mw->title($titleVar);

	my $label=$mw->Label(-text=>$textVar, -wraplength=>190, -font=>($mw->fontCreate(-family=>"courier",-size=>10)))->
	           place(-y=>10,-x=>10, -width=>190, -height=>100);
        my $cmdCancel=$mw->Button(-text=>"NO", -relief=>'flat',-command=> sub{&myNo})->
       		   place(-y=>$ht-30,-x=>10,-width=>80, -height=>20);

        my $cmdOk=$mw->Button(-text =>"YES",-relief=>'flat', -command => sub{&myYes;})->
       		   place(-y=>$ht-30,-x=>110,-width=>80,-height=>20);

        $mw->waitVariable( \$returnVal ) ;
        $mw->withdraw ;

        $returnVal;
}


sub myYes(){

}

sub myNo(){
   $returnVal=0;
}
