#!/usr/local/bin/perl
#
# BrowseEntry
#
# Class to provide an improved BrowseEntry widget
#
# Author: Jennifer Liddle (js10)
#
# $Id: BrowseEntry.pm,v 1.1 2005/09/28 13:41:21 js10 Exp $
#
# $Log: BrowseEntry.pm,v $
# Revision 1.1  2005/09/28 13:41:21  js10
# first working version
#
#

package SITk::BrowseEntry;


=head1 NAME

SITk::BrowseEntry - improved BrowseEntry widget

=cut

use Tk;
use base qw(Tk::Derived Tk::BrowseEntry);
Tk::Widget->Construct('BrowseEntry');

sub Populate
{
	my $self = shift;
	my $args = shift;

	# Set default config items
	$args->{-state} ||= 'readonly';

	# store or create a variable reference
	if ($args->{-variable}) {
		$self->{varRef} = $args->{-variable} if ($args->{-variable});
	} else {
		$self->{variable} = '';
		$self->{varRef} = \$self->{variable};
		$args->{-variable} = $self->{varRef};
	}

	# Finish constructing the BrowseEntry
	$self->SUPER::Populate($args);

	return $self;
}

sub get
{
	my $self = shift;
	return ${$self->{varRef}};
}

sub put
{
	my $self = shift;
	my $txt = shift;
	${$self->{varRef}} = $txt;
}


1;
