summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Tk/Image.pm
blob: 0f41c387fc2c0bfb08c9c634f6059f321977b924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright (c) 1995-2003 Nick Ing-Simmons. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
package Tk::Image;

# This module does for images what Tk::Widget does for widgets:
# provides a base class for them to inherit from.
require DynaLoader;

use base qw(DynaLoader Tk); # but are they ?

use vars qw($VERSION);
$VERSION = '4.011'; # $Id: //depot/Tkutf8/Tk/Image.pm#11 $

sub new
{
 my $package = shift;
 my $widget  = shift;
 $package->InitClass($widget);
 my $leaf = $package->Tk_image;
 my $obj = $widget->Tk::image('create',$leaf,@_);
 $obj = $widget->_object($obj) unless (ref $obj);
 return bless $obj,$package;
}

sub Install
{
 # Dynamically loaded image types can install standard images here
 my ($class,$mw) = @_;
}

sub ClassInit
{
 # Carry out class bindings (or whatever)
 my ($package,$mw) = @_;
 return $package;
}

require Tk::Submethods;

Direct Tk::Submethods ('image' => [qw(delete width height type)]);

sub Tk::Widget::imageNames
{
 my $w = shift;
 $w->image('names',@_);
}

sub Tk::Widget::imageTypes
{
 my $w = shift;
 map("\u$_",$w->image('types',@_));
}

sub Construct
{
 my ($base,$name) = @_;
 my $class = (caller(0))[0];

 # Hack for broken ->isa in perl5.6.0
 delete ${"$class\::"}{'::ISA::CACHE::'} if $] == 5.006;

 *{"Tk::Widget::$name"}  = sub { $class->new(@_) };
}

# This is here to prevent AUTOLOAD trying to find it.
sub DESTROY
{
 my $i = shift;
 # maybe do image delete ???
}


1;