| Games-Pandemic documentation | Contained in the Games-Pandemic distribution. |
Games::Pandemic::Tk::Utils - Tk utilities for gui building
version 1.111030
This module exports some useful subs for tk guis.
Return a tk image loaded from $path. If the photo has already been
loaded, return a handle on it. If $toplevel is given, it is used as
base window to load the image.
Return a tk image to be used as $toplevel icon throughout the game.
Jerome Quelin
This software is Copyright (c) 2009 by Jerome Quelin.
This is free software, licensed under:
The GNU General Public License, Version 2, June 1991
| Games-Pandemic documentation | Contained in the Games-Pandemic distribution. |
# # This file is part of Games-Pandemic # # This software is Copyright (c) 2009 by Jerome Quelin. # # This is free software, licensed under: # # The GNU General Public License, Version 2, June 1991 # use 5.010; use strict; use warnings; package Games::Pandemic::Tk::Utils; BEGIN { $Games::Pandemic::Tk::Utils::VERSION = '1.111030'; } # ABSTRACT: Tk utilities for gui building use File::Spec::Functions qw{ catfile }; use Moose; use POE; extends 'Exporter'; use Games::Pandemic::Utils; our @EXPORT = qw{ image pandemic_icon }; # -- public subs sub image { my ($path, $toplevel) = @_; $toplevel //= $poe_main_window; # //FIXME: padre my $img = $poe_main_window->Photo($path); return $img if $img->width; return $toplevel->Photo("$toplevel-$path", -file=>$path); } sub pandemic_icon { return image( catfile($SHAREDIR, 'icon.png'), @_ ); } no Moose; __PACKAGE__->meta->make_immutable; 1;
__END__