fix console.pl max scroll depth
[spider.git] / gtkconsole / Text.pm
1 #
2 # create a text area with scroll bars
3 #
4 # Copyright (c) 2001 Dirk Koopman G1TLH
5 #
6 #
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         my $style = $text->style;
25         $style->font($font);
26         $text->set_style($style);
27         $text->show;
28         my $vscroll = new Gtk::VScrollbar($text->vadj);
29         $vscroll->show;
30         my $box = new Gtk::HBox();
31         $box->add($text);
32         $box->pack_start($vscroll, 0,0,0);
33         $box->show;
34
35         my $self = bless $box, $pkg;
36         $self->{text} = $text;
37         $self->{text}->{font} = $font;
38         return $self;
39 }
40
41 sub destroy
42 {
43         my $self = shift;
44         delete $self->{text}->{font};
45         delete $self->{text};
46 }
47
48 sub text
49 {
50         return shift->{text};
51 }
52
53 1;