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
-
For defaults see above. Only available at create time.
- Switch: -iconsize
-
Default is 16.
- Name : iconTheme
- Class : IconTheme
- Switch: -icontheme
-
Default is Oxygen.
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
- AvailableContexts($theme, [ $name, $size ] );
-
Returns a list of available contexts. If you set $name to undef if will return all contexts of size $size. If you set $size to undef it will return all contexts associated with icon $name. If you set $name and $size to undef it will return all known contexts in the theme. out $size it returns a list of all contexts found in $theme.
- AvailableIcons($theme, [ $size, $context ] );
-
Returns a list of available icons. If you set $size to undef the list will contain names it found in all sizes. If you set $context to undef it will return names it found in all contexts. If you leave out both then you get a list of all available icons. Watch out, it might be pretty long.
- AvailableThemes
-
Returns a list of available themes it found while initiating the module.
- AvailableSizes($theme, [ $name, $context ] );
-
Returns a list of available contexts. If you leave out $size it returns a list of all contexts found in $theme.
- CreateCompound(%args)
-
Creates and returns a compound image. %args can have the following keys;
-image Reference to a Tk::Image object.
-orient Either 'Horizontal' or 'Vertical'. Default is 'Horizontal'.
-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.
- FindImage($name, [ $size, $context, \$resize ] );
-
Returns the filename of an image in the library. Finds the best suitable version of the image in the library according to $size and $context. If it eventually returns an image of another size, it sets $resize to 1. This gives the opportunity to scale the image to the requested icon size. All parameters except $name are optional.
- FindLibImage($name, [ $size, $context, \$resize ] );
-
Returns the filename of an image in the library. Finds the best suitable version of the image in the library according to $size and $context. If it eventually returns an image of another size, it sets $resize to 1. This gives the opportunity to scale the image to the requested icon size. All parameters except $name are optional.
- FindRawImage($name, [ $size, $context, \$resize ] );
-
Returns the filename of an image in the library. Finds the best suitable version of the image in the library according to $size and $context. If it eventually returns an image of another size, it sets $resize to 1. This gives the opportunity to scale the image to the requested icon size. All parameters except $name are optional.
- GetAlternateSize($size)>
-
Tests if $size is available in the current itecontheme. Returns the first size that is larger than $size if it is not.
- GetIcon($name, [ $size, $context, $force ] );
-
Returns a Tk::Image. 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.
- GetTheme($themename)
-
Looks for a searchable index of the theme. If it is not yet created it will be created first and stored in the index pool.
- GetThemePath($theme)
-
Returns the full path to the folder containing $theme
- IsImageFile($file)
-
Returns true if $file is an image. Otherwise returns false.
- LoadImage($file)
-
Loads image $file and returns it as a Tk::Photo object.
- LoadThemeFile($file)
-
Loads a theme index file and returns the information in it in a hash. It returns a reference to this hash.
LICENSE
Same as Perl.
AUTHOR
Hans Jeuken (hanje at cpan dot org)
BUGS
Unknown. If you find any, please contact the author.