/usr/lib/perl5/Prima/StdBitmap.pm is in libprima-perl 1.28-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | #
# Copyright (c) 1997-2002 The Protein Laboratory, University of Copenhagen
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Created by Dmitry Karasik <dk@plab.ku.dk>
#
# $Id: StdBitmap.pm,v 1.17 2005/10/13 17:22:51 dk Exp $
package Prima::StdBitmap;
use vars qw($sysimage);
use strict;
use Prima;
use Prima::Utils;
my %bmCache;
sub load_std_bmp
{
my ( $index, $asIcon, $copy, $imageFile) = @_;
my $class = ( $asIcon ? q(Prima::Icon) : q(Prima::Image));
return undef if !defined $index || !defined $imageFile || $index < 0;
$asIcon = ( $asIcon ? 1 : 0);
if ( $copy) {
my $i = $class-> create(name => $index);
undef $i unless $i-> load( $imageFile, index => $index);
return $i;
}
$bmCache{$imageFile} = {} unless exists $bmCache{$imageFile};
my $x = $bmCache{$imageFile};
return $x-> {$index}-> [$asIcon] if exists $x-> {$index} && defined $x-> {$index}-> [$asIcon];
$x-> {$index} = [ undef, undef] unless exists $x-> {$index};
my $i = $class-> create(name => $index);
undef $i unless $i-> load( $imageFile, index => $index);
$x-> {$index}-> [$asIcon] = $i;
return $i;
}
$sysimage = Prima::Utils::find_image(
((Prima::Application-> get_system_info-> {apc} == apc::Win32) ? 'sys/win32/' : '') .
"sysimage.gif")
unless defined $sysimage;
sub icon { return load_std_bmp( $_[0], 1, 0, $sysimage); }
sub image{ return load_std_bmp( $_[0], 0, 0, $sysimage); }
1;
__DATA__
=pod
=head1 NAME
Prima::StdBitmap - shared access to the standard toolkit bitmaps
=head1 DESCRIPTION
The toolkit contains F<sysimage.gif> image library, which consists of
a predefined set of images, used in several toolkit modules. To provide
a unified access to the images this module can be used. The images are
assigned a C<sbmp::> constant, which is used as an index on a load
request. If loaded successfully, images are cached and the successive
requests return the cached values.
The images can be loaded as C<Prima::Image> and C<Prima::Icon> instances.
To discriminate, two methods are used, correspondingly C<image> and C<icon>.
=head1 SYNOPSIS
use Prima::StdBitmap;
my $logo = Prima::StdBitmap::icon( sbmp::Logo );
=head1 API
=head2 Methods
=over
=item icon INDEX
Loads INDEXth image frame and returns C<Prima::Icon> instance.
=item image INDEX
Loads INDEXth image frame and returns C<Prima::Image> instance.
=item load_std_bmp INDEX, AS_ICON, USE_CACHED_VALUE, IMAGE_FILE
Loads INDEXth image frame from IMAGE_FILE and returns it as either a C<Prima::Image> or
as a C<Prima::Icon> instance, depending on value of boolean AS_ICON flag. If
USE_CACHED_VALUE boolean flag is set, the cached images loaded previously
can be used. If this flag is unset, the cached value is never used, and the
created image is not stored in the cache. Since the module's intended use
is to provide shared and read-only access to the image library, USE_CACHED_VALUE
set to 0 can be used to return non-shared images.
=back
=head2 Constants
An index value passed to the methods must be one of C<sbmp::> constants:
sbmp::Logo
sbmp::CheckBoxChecked
sbmp::CheckBoxCheckedPressed
sbmp::CheckBoxUnchecked
sbmp::CheckBoxUncheckedPressed
sbmp::RadioChecked
sbmp::RadioCheckedPressed
sbmp::RadioUnchecked
sbmp::RadioUncheckedPressed
sbmp::Warning
sbmp::Information
sbmp::Question
sbmp::OutlineCollaps
sbmp::OutlineExpand
sbmp::Error
sbmp::SysMenu
sbmp::SysMenuPressed
sbmp::Max
sbmp::MaxPressed
sbmp::Min
sbmp::MinPressed
sbmp::Restore
sbmp::RestorePressed
sbmp::Close
sbmp::ClosePressed
sbmp::Hide
sbmp::HidePressed
sbmp::DriveUnknown
sbmp::DriveFloppy
sbmp::DriveHDD
sbmp::DriveNetwork
sbmp::DriveCDROM
sbmp::DriveMemory
sbmp::GlyphOK
sbmp::GlyphCancel
sbmp::SFolderOpened
sbmp::SFolderClosed
sbmp::Last
=head2 Scalars
C<$sysimage> scalar is initialized to the file name to be used
as a source of standard image frames by default. It is possible
to alter this scalar at run-time, which causes all subsequent
image frame request to be redirected to the new file.
=head1 AUTHOR
Dmitry Karasik, E<lt>dmitry@karasik.eu.orgE<gt>.
=head1 SEE ALSO
L<Prima>, L<Prima::Image>, L<Prima::Const>.
=cut
|