# class KIconLoader | Iconloader for KDE. More...
Definition | `#include <kiconloader.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KIconLoader (const QString& appname=QString::null, KStandardDirs *dirs = 0)
- ~KIconLoader ()
- void addAppDir (const QString& appname)
- QPixmap loadIcon (const QString& name, int group, int size=0, int state=KIcon::DefaultState, QString *path_store=0L, bool canReturnNull=false) const
- QString iconPath (const QString& name, int group_or_size, bool canReturnNull=false) const
- QStringList loadAnimated (const QString& name, int group, int size=0) const
- QStringList queryIcons (int group_or_size, int context=KIcon::Any) const
- QStringList queryIconsByContext (int group_or_size, int context=KIcon::Any) const
- int currentSize (int group)
- KIconTheme * theme ()
- KIconEffect * iconEffect ()
- QImage * image (int serialNumber) const
- void reconfigure ( const QString& _appname, KStandardDirs *_dirs )
- bool alphaBlending ( int group ) const

#### Public Static Methods

- static QPixmap unknown ()

## Detailed Description

Iconloader for KDE.

KIconLoader will load the current icon theme and all its base themes. Icons will be searched in any of these themes. Additionally, it caches icons and applies effects according the the user's preferences.

In KDE, it is encouraged to load icons by "Group". An icon group is a location on the screen where icons are being used. Standard groups are: Desktop, Toolbar, MainToolbar, Small and Panel. Each group has some centrally configured properties bound to it, including the icon size and effects. This makes it possible to offer a consistent icon look in all KDE applications.

The standard groups are defined below.

- KIcon::Desktop: Icons in the iconview of konqueror, kdesktop and similar apps.
- KIcon::Toolbar: Icons in toolbars.
- KIcon::MainToolbar: Icons in the main toolbars.
- KIcon::Small: Various small (typical 16x16) places: titlebars, listviews and menu entries.
- KIcon::Panel: Icons in kicker's panel

The icons are stored on disk in an icon theme or in a standalone directory. The icon theme directories contain multiple sizes and/or depths for the same icon. The iconloader will load the correct one based on the icon group and the current theme. Icon themes are stored globally in share/icons, or, application specific in share/apps/$appdir/icons.

The standalone directories contain just one version of an icon. The directories that are searched are: $appdir/pics and $appdir/toolbar. Icons in these directories can be loaded by using the special group "User".

KIconLoader (const QString& appname=QString::null, KStandardDirs *dirs = 0) | ### KIconLoader

Construct the iconloader.

Parameters:

appname | Add the data directories of this application to the icon search path for the "User" group. The default argument adds the directories of the current application.
the | KStandardDirs object to use. If null the global one is used

~KIconLoader () | ### ~KIconLoader

void addAppDir (const QString& appname) | ### addAppDir

Add `appname` to the list of application specific directories.

Parameters:

appname | The application name.

QPixmap loadIcon (const QString& name, int group, int size=0, int state=KIcon::DefaultState, QString *path_store=0L, bool canReturnNull=false) | ### loadIcon

[const]

Load an icon. It will try very hard to find an icon which is suitable. If no exact match is found, a close match is searched. If neither an exact nor a close match is found, a null pixmap or the "unknown" pixmap is returned, depending on the value of the `canReturnNull` parameter.

Parameters:

name | The name of the icon, without extension.
group | The icon group. This will specify the size of and effects to be applied to the icon.
size | If nonzero, this overrides the size specified by `group`.
state | The icon state: `DefaultState`, `ActiveState` or `DisabledState`. Depending on the user's preferences, the iconloader may apply a visual effect to hint about its state.
path_store | If not null, the path of the icon is stored here.
canReturnNull | Can return a null pixmap? If false, the "unknown" pixmap is returned when no appropriate icon has been found.

QString iconPath (const QString& name, int group_or_size, bool canReturnNull=false) | ### iconPath

[const]

Returns the path of an icon.

Parameters:

name | The name of the icon, without extension.
group_or_size | If positive, search icons whose size is specified by the icon group `group_or_size`. If negative, search icons whose size is - `group_or_size`.
canReturnNull | Can return a null pixamp?

QStringList loadAnimated (const QString& name, int group, int size=0) | ### loadAnimated

[const]

Load an animated icon. In the future, this will be replaced by a routine which loads an MNG animation and returns a QMovie.

Parameters:

name | The name of the icon.
group | The icon group. See loadIcon().
size | Override the default size for `group`.

Returns: A QStringList containing the absolute path of all the frames making up the animation.

QStringList queryIcons (int group_or_size, int context=KIcon::Any) | ### queryIcons

[const]

Query all available icons for a specific group, having a specific context.

Parameters:

group_or_size | The icon group or size. See iconPath.
context | The icon context.

QStringList queryIconsByContext (int group_or_size, int context=KIcon::Any) | ### queryIconsByContext

[const]

Query all available icons for a specific context.

Parameters:

group_or_size | The icon preferred group or size. If available at this group or size, those icons will be returned, in other case, icons of undefined size will be returned.
context | The icon context.

Returns: A QStringList containing the icon names available for that context

int currentSize (int group) | ### currentSize

Returns: the current size for an icon group.

KIconTheme * theme () | ### theme

Returns a pointer to the current theme. Can be used to query available and default sizes for groups.

KIconEffect * iconEffect () | ### iconEffect

Returns a pointer to the KIconEffect object used by the icon loader.

QImage * image (int serialNumber) | ### image

[const]

Returns the image associated with a given serialNumber. You should use the serialNumber of a pixmap returned by loadIcon (or any of the [Group]Icon helper functions).

void reconfigure ( const QString& _appname, KStandardDirs *_dirs ) | ### reconfigure

Called by KInstance::newIconLoader to reconfigure the icon loader

QPixmap unknown () | ### unknown

[static]

Returns the unknown icon. An icon that is used when no other icon can be found.

bool alphaBlending ( int group ) | ### alphaBlending

[const]

Returns if the user wants to use blend the icons with the background using the alpha channel information for a given group.

Generated by: root@sparc.ports.openbsd.org on Wed May 2 09:34:58 2001, using kdoc 2.0a53.