NAME

Tk::AppWindow::Ext::Art - Use icon libraries quick & easy

SYNOPSIS

my $app = new Tk::AppWindow(@options,
   -extensions => ['Art'],
);
$app->MainLoop;

DESCRIPTION

This extension allows Tk::AppWindow easy access to icon libraries used in desktops like KDE and GNOME.

if you are not on Windows, it supports libraries containing scalable vector graphics like Breeze.

On Windows you have to install icon libraries yourself in C:\ProgramData\Icons. You will find plenty of them on Github. Extract an icon set and copy the main folder of the theme (the one that contains the file 'index.theme') to C:\ProgramData\Icons. On Linux you will probably find some icon themes in /usr/share/icons.

The constructor takes a reference to a list of folders where it finds the icons libraries. If you specify nothing, it will assign default values for:

Windows: $ENV{ALLUSERSPROFILE} . '\Icons'. Art will not create the folder if it does not exist.

Others: $ENV{HOME} . '/.local/share/icons', '/usr/share/icons'

CONFIG VARIABLES

Switch: -compoundcolspace

Default value 5. Used in the createCompound method to set horizontal spacing.

Switch: -iconpath

Specify a list of folders where your icon libraries are located. Only available at create time.

Name : iconSize
Class : IconSize
Switch: -iconsize

Default is 16.

Name : iconTheme
Class : IconTheme
Switch: -icontheme

Default is Oxygen.

Switch: -rawiconpath

List of folders where you store your raw icons. Defaults to an empty list.

COMMANDS

The following commands are defined.

available_icon_sizes

Returns a list of available icon sizes.

available_icon_themes

Returns a list of available icon themes.

METHODS

cacheDisabled(?$flag?)

Sets and returns the state of the cache. If the cache is disabled, images will allways be loaded from disk.

cacheClear

Clears the cache.

canRotateText

Returns true if facilities for rotating text are in place. On linux this means the command 'fc-list' works.

createCompound(%args)

Creates and returns a compound image. %args can have the following keys;

-image Reference to a Tk::Image object.

-textrotate An angle in degrees.

-text Text to be displayed.

textside Can be 'left', 'right', 'top' or 'bottom'. Default is 'right'.

createEmptyImage(?$width?, ?$height?)

Creates and returns aan empty image. Nothing to see, just taking up space. If $width is not specified it defaults to the -iconsize config variable. If $height is not specified it defaults to $width.

getAlternateSize($size)>

Tests if $size is available in the current itecontheme. Returns the first size that is larger than $size if it is not.

getFileIcon($file, [ $size, $context ] );

Determines the mime type of $file and returns the belonging icon. If it can not determine the mime type, the default file icon is returned.

getIcon($name, [ $size, $context ] );

Returns a Tk::Photo object. If you do not specify $size or the icon does not exist in the specified size, it will find the largest possible icon and scale it to the requested size. $force can be 0 or 1. It is 0 by default. If you set it to 1 a missing icon image is returned instead of undef when the icon cannot be found.

imagerFont($tkfontobject);

Takes a Tk::Font object and returns it as a Imager::Font object.

loadImage($file, ?$width?, ?$height?)

Loads image $file and returns it as a Tk::Photo object. It will resize the image to $width and $height if they are specified. if only $width is specified height is set equal to width.

text2image($text, ?$rotate?)

Returns a Tk::Photo class with $text as image. $rotate specifies how much the text must be rotated in degrees. On linux this only works if the command 'fc-list' is available.

LICENSE

Same as Perl.

AUTHOR

Hans Jeuken (hanje at cpan dot org)

BUGS

Unknown. If you find any, please contact the author.

SEE ALSO

Tk::AppWindow
Tk::AppWindow::BaseClasses::Extension