Class Documentation

Name:IconServer
Version:1.0
ID:ID_ICONSERVER
Status:Stable
Date:January 2004
Author:Rocklyte Systems
Copyright:  Rocklyte Systems (c) 2003-2004. All rights reserved.



Description

The IconServer class provides an icon management and image resizing service for Athene. It provides this service through the icons: assignment. Icons are requested from the server by accessing them through the virtual filesystem, making access to the icon server 'invisible'. Direct contact with the icon server only needs to be made when requesting a new theme, or to change the default icon size.

Icon files can be accessed from the icon server using the following file path formats:

   icons:filename
   icons:category/filename
   icons:category/filename(size)

The second format, where the category and filename is specified is recommended for normal usage. The size of the icon can be requested by entering a numeral in brackets at the end of the location. For instance 'icons:programs/filemanager(64)' will generate a 64x64 pixel version of the filemanager icon. The minimum size for an icon is 16 pixels and the maximum size is 256 pixels.

Actions

The IconServer class supports the following actions:

Clear  Removes all cached images generated by the icon server.
Refresh  Regenerates the icon database.

Structure

The IconServer object consists of the following public fields:

Cache  Switch off the cache by writing a FALSE value to this field.
CacheSize  Indicates the total size of the icon cache in bytes.
IconRatio  Setting this field enables dynamic icon sizing that is relative to the display size.
IconSize  The default size of each icon generated by the server can be changed here.
Theme  The theme used by an iconserver object is set here.
Field:Cache
Short:Switch off the cache by writing a FALSE value to this field.
Type:LONG
Status:Read/Write

By default, all generated icons are cached on the hard drive for high speed loading whenever an icon is requested at a previously generated size. This can potentially be a problem when developing new icon sets or adjusting the icon database, as you may want to regenerate each icon from scratch. Turning off the cache will typically fix such problems.


Field:CacheSize
Short:Indicates the total size of the icon cache in bytes.
Type:LONG
Status:Get

This field can be read at any time to determine the total number of bytes in use by the icon cache. The result value is generated dynamically through analysis of the icon directory structure. Only the current theme is included in the result value.


Field:IconRatio
Short:Setting this field enables dynamic icon sizing that is relative to the display size.
Type:FLOAT
Status:Read/Set

The IconRatio field can be set if you wish to enable dynamic icon sizing. This field is set as a percentage, typically around 7%, which would generate icons at 7% of the current display's shortest dimension (usually the height).

The minimum ratio is 2% and the maximum is 15%. When you write to this field, fixed icon sizes will no longer be the default. You can switch back to fixed icon sizes if you write a value to the IconSize field. Fixed size icons can also be requested at any time on an individual basis by passing a size to the icons: assignment when loading icons.

Regardless of the ratio setting, the maximum and minimum pixel size of any icon is always 16 and 256 pixels respectively.


Field:IconSize
Short:The default size of each icon generated by the server can be changed here.
Type:LONG
Status:Read/Set

By default, the iconserver will generate icons at a size of 32 pixels when no specific size has been requested. You may set this field to increase or decrease the default icon size. The minimum and maximum values are 16 and 256 pixels respectively.


Field:Theme
Short:The theme used by an iconserver object is set here.
Type:STRING
Status:Get/Set

The theme currently in use by the iconserver is set here. You can alter the theme at any time by writing the name of the new theme to this field. The name must be represented in the 'pictures:icons/' directory tree or the theme will revert back to the default setting. When you change the theme, the icon database will be refreshed. This may take some time depending on the number of icons to process.