class KIconLoader

Iconloader for KDE. More...

Definition#include <kiconloader.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods


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.

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

Constructs an iconloader.

Usually, you use the default iconloader, which can be accessed via KGlobal::iconLoader(), so you hardly ever have to create an iconloader object yourself. That one is the current KInstance's (typically KApplication's) iconloader.

Parameters:
appnameAdd 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.
theKStandardDirs object to use. If null the global one is used

See also: KGlobal::iconLoader(), KInstance::iconLoader()

 ~KIconLoader ()

~KIconLoader

Cleanup

void  addAppDir (const QString& appname)

addAppDir

Adds appname to the list of application specific directories.

Parameters:
appnameThe application name.

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

loadIcon

[const]

Loads 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:
nameThe name of the icon, without extension.
groupThe icon group. This will specify the size of and effects to be applied to the icon.
sizeIf nonzero, this overrides the size specified by group. See KIcon::StdSizes.
stateThe 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_storeIf not null, the path of the icon is stored here.
canReturnNullCan return a null pixmap? If false, the "unknown" pixmap is returned when no appropriate icon has been found.

Returns: the QPixmap. Can be null when not found, depending on canReturnNull.

QIconSet  loadIconSet (const QString& name, KIcon::Group group, int size, bool canReturnNull)

loadIconSet

Creates an icon set, that will do on-demand loading of the icon. Loading itself is done by calling loadIcon .

Parameters:
nameThe name of the icon, without extension.
groupThe icon group. This will specify the size of and effects to be applied to the icon.
sizeIf nonzero, this overrides the size specified by group. See KIcon::StdSizes.
canReturnNullCan return a null iconset? If false, iconset containing the "unknown" pixmap is returned when no appropriate icon has been found.

Returns: the icon set. Can be null when not found, depending on canReturnNull.

QIconSet  loadIconSet (const QString& name, KIcon::Group group, int size=0)

loadIconSet

Creates an icon set, that will do on-demand loading of the icon. Loading itself is done by calling loadIcon .

Parameters:
nameThe name of the icon, without extension.
groupThe icon group. This will specify the size of and effects to be applied to the icon.
sizeIf nonzero, this overrides the size specified by group. See KIcon::StdSizes.

Returns: the icon set. Can be null when not found

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

iconPath

[const]

Returns the path of an icon.

Parameters:
nameThe name of the icon, without extension. If an absolute path is supplied for this parameter, iconPath will return it directly.
group_or_sizeIf positive, search icons whose size is specified by the icon group group_or_size. If negative, search icons whose size is - group_or_size. See KIcon::Group and KIcon::StdSizes
canReturnNullCan return a null string? If not, a path to the "unknown" icon will be returned.

Returns: the path of an icon, can be null or the "unknown" icon when not found, depending on canReturnNull.

QMovie  loadMovie (const QString& name, KIcon::Group group, int size=0)

loadMovie

[const]

Loads an animated icon.

Parameters:
nameThe name of the icon.
groupThe icon group. See loadIcon().
sizeOverride the default size for group. See KIcon::StdSizes.

Returns: A QMovie object. Can be null if not found.

QString  moviePath (const QString& name, KIcon::Group group, int size=0)

moviePath

[const]

Returns the path to an animated icon.

Parameters:
nameThe name of the icon.
groupThe icon group. See loadIcon().
sizeOverride the default size for group. See KIcon::StdSizes.

Returns: the full path to the movie, ready to be passed to QMovie's constructor. Empty string if not found.

QStringList  loadAnimated (const QString& name, KIcon::Group group, int size=0)

loadAnimated

[const]

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

Parameters:
nameThe name of the icon.
groupThe icon group. See loadIcon().
sizeOverride the default size for group. See KIcon::StdSizes.

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

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

queryIcons

[const]

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

Parameters:
group_or_sizeIf positive, search icons whose size is specified by the icon group group_or_size. If negative, search icons whose size is - group_or_size. See KIcon::Group and KIcon::StdSizes
contextThe icon context.

Returns: a list of all icons

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

queryIconsByContext

[const]

Queries all available icons for a specific context.

Parameters:
group_or_sizeThe 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. Positive numbers are groups, negative numbers are negated sizes. See KIcon::Group and KIcon::StdSizes
contextThe icon context.

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

QStringList  queryIconsByDir ( const QString& iconsDir )

queryIconsByDir

[const]

Returns a list of all icons (*.png or *.xpm extension) in the given directory.

Parameters:
iconsDirthe directory to search in

Returns: A QStringList containing the icon paths

int  currentSize (KIcon::Group group)

currentSize

[const]

Returns the current size of the group.

Parameters:
groupthe group to check.

Returns: the current size for an icon group.

KIconThemetheme ()

theme

[const]

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

Returns: a pointer to the current theme. 0 if no theme set.

KIconEffecticonEffect ()

iconEffect

[const]

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

Returns: the KIconEffect.

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

reconfigure

Called by KInstance::newIconLoader to reconfigure the icon loader.

Parameters:
_appnamethe new application name
_dirsthe new standard directories. If 0, the directories from KGlobal will be taken.

QPixmap  unknown ()

unknown

[static]

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

Returns: the unknown pixmap

bool  alphaBlending ( KIcon::Group 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.

Parameters:
groupthe group to check

Returns: true if alpha blending is desired @obsolete

void  addExtraDesktopThemes ()

addExtraDesktopThemes

Adds all the default themes from other desktops at the end of the list of icon themes.

bool  extraDesktopThemesAdded ()

extraDesktopThemesAdded

[const]

Returns if the default icon themes of other desktops have been added to the list of icon themes where icons are searched.

void  enableDelayedIconSetLoading ( bool enable )

enableDelayedIconSetLoading

Enables on-demand icon loading for QIconSets using QIconFactory. Icons loaded via loadIconSet() will be loaded as soon as they need to be displayed, not earlier.

Note that enabling or disabling this only affects loadIconSet() calls after this setting is changed.

The default is disabled, as the iconloader object must not be destroyed before all those iconsets are destroyed.

(Some broken applications use temporary KIconLoader objects). Every KInstance 's iconloader has this feature enabled.

See also: QIconFactory, QIconFactory

bool  isDelayedIconSetLoadingEnabled ()

isDelayedIconSetLoadingEnabled

[const]

Returns: whether icons for QIconSets will be loaded on demand.

See also: QIconFactory, QIconFactory


Generated by: caleb on tcdevel on Tue Jan 28 12:54:04 2003, using kdoc $.