added gtkconsole
[spider.git] / gtkconsole / Text.pm
1 #
2 # create a text area with scroll bars
3 #
4 # Copyright (c) 2001 Dirk Koopman G1TLH
5 #
6 # $Id$
7 #
8
9 package Text;
10
11 use strict;
12 use Gtk;
13
14 use vars qw(@ISA);
15 @ISA = qw(Gtk::Text);
16
17 sub new
18 {
19         my $pkg = shift;
20         my ($vbar, $hbar) = @_;
21         
22         my $font = Gtk::Gdk::Font->load("-misc-fixed-medium-r-normal-*-*-130-*-*-c-*-koi8-r");
23         my $text = new Gtk::Text(undef,undef);
24         $text->show;
25         my $vscroll = new Gtk::VScrollbar($text->vadj);
26         $vscroll->show;
27         my $box = new Gtk::HBox();
28         $box->add($text);
29         $box->pack_start($vscroll, 0,0,0);
30         $box->show;
31
32         my $self = bless $box, $pkg;
33         $self->{text} = $text;
34         $self->{text}->{font} = $font;
35         return $self;
36 }
37
38 sub destroy
39 {
40         my $self = shift;
41         delete $self->{text}->{font};
42         delete $self->{text};
43 }
44
45 sub text
46 {
47         return shift->{text};
48 }
49
50 1;