#include <kiconloader.h>
Public Member Functions | |
TDEIconLoader (const TQString &appname=TQString::null, TDEStandardDirs *dirs=0) | |
~TDEIconLoader () | |
void | addAppDir (const TQString &appname) |
TQPixmap | loadIcon (const TQString &name, TDEIcon::Group group, int size=0, int state=TDEIcon::DefaultState, TQString *path_store=0L, bool canReturnNull=false) const |
TQIconSet | loadIconSet (const TQString &name, TDEIcon::Group group, int size, bool canReturnNull, bool immediateExistenceCheck) |
TQIconSet | loadIconSet (const TQString &name, TDEIcon::Group group, int size, bool canReturnNull) |
TQIconSet | loadIconSet (const TQString &name, TDEIcon::Group group, int size=0) |
TQString | iconPath (const TQString &name, int group_or_size, bool canReturnNull=false) const |
TQMovie | loadMovie (const TQString &name, TDEIcon::Group group, int size=0) const |
TQString | moviePath (const TQString &name, TDEIcon::Group group, int size=0) const |
TQStringList | loadAnimated (const TQString &name, TDEIcon::Group group, int size=0) const |
TQStringList | queryIcons (int group_or_size, TDEIcon::Context context=TDEIcon::Any) const |
TQStringList | queryIconsByContext (int group_or_size, TDEIcon::Context context=TDEIcon::Any) const |
bool | hasContext (TDEIcon::Context context) const |
TQStringList | queryIconsByDir (const TQString &iconsDir) const |
int | currentSize (TDEIcon::Group group) const |
TDEIconTheme * | theme () const |
TDEIconEffect * | iconEffect () const |
void | reconfigure (const TQString &_appname, TDEStandardDirs *_dirs) |
bool | alphaBlending (TDEIcon::Group group) const |
void | addExtraDesktopThemes () |
bool | extraDesktopThemesAdded () const |
void | enableDelayedIconSetLoading (bool enable) |
bool | isDelayedIconSetLoadingEnabled () const |
Static Public Member Functions | |
static TQPixmap | unknown () |
Related Functions | |
(Note that these are not member functions.) | |
TQPixmap | DesktopIcon (const TQString &name, int size=0, int state=TDEIcon::DefaultState, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | DesktopIcon (const TQString &name, TDEInstance *instance) |
TQIconSet | DesktopIconSet (const TQString &name, int size=0, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | BarIcon (const TQString &name, int size=0, int state=TDEIcon::DefaultState, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | BarIcon (const TQString &name, TDEInstance *instance) |
TQIconSet | BarIconSet (const TQString &name, int size=0, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | SmallIcon (const TQString &name, int size=0, int state=TDEIcon::DefaultState, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | SmallIcon (const TQString &name, TDEInstance *instance) |
TQIconSet | SmallIconSet (const TQString &name, int size=0, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | MainBarIcon (const TQString &name, int size=0, int state=TDEIcon::DefaultState, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | MainBarIcon (const TQString &name, TDEInstance *instance) |
TQIconSet | MainBarIconSet (const TQString &name, int size=0, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | UserIcon (const TQString &name, int state=TDEIcon::DefaultState, TDEInstance *instance=TDEGlobal::instance()) |
TQPixmap | UserIcon (const TQString &name, TDEInstance *instance) |
TQIconSet | UserIconSet (const TQString &name, TDEInstance *instance=TDEGlobal::instance()) |
int | IconSize (TDEIcon::Group group, TDEInstance *instance=TDEGlobal::instance()) |
Detailed Description
Iconloader for KDE.
TDEIconLoader 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.
- TDEIcon::Desktop: Icons in the iconview of konqueror, kdesktop and similar apps.
- TDEIcon::Toolbar: Icons in toolbars.
- TDEIcon::MainToolbar: Icons in the main toolbars.
- TDEIcon::Small: Various small (typical 16x16) places: titlebars, listviews and menu entries.
- TDEIcon::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".
Definition at line 77 of file kiconloader.h.
Constructor & Destructor Documentation
◆ TDEIconLoader()
TDEIconLoader::TDEIconLoader | ( | const TQString & | appname = TQString::null , |
TDEStandardDirs * | dirs = 0 |
||
) |
Constructs an 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. dirs the TDEStandardDirs object to use. If null the global one is used
Usually, you use the default iconloader, which can be accessed via TDEGlobal::iconLoader(), so you hardly ever have to create an iconloader object yourself. That one is the current TDEInstance's (typically TDEApplication's) iconloader.
Definition at line 134 of file kiconloader.cpp.
◆ ~TDEIconLoader()
TDEIconLoader::~TDEIconLoader | ( | ) |
Cleanup.
Definition at line 267 of file kiconloader.cpp.
Member Function Documentation
◆ addAppDir()
void TDEIconLoader::addAppDir | ( | const TQString & | appname | ) |
Adds appname
to the list of application specific directories.
- Parameters
-
appname The application name.
Definition at line 299 of file kiconloader.cpp.
◆ addExtraDesktopThemes()
void TDEIconLoader::addExtraDesktopThemes | ( | ) |
Adds all the default themes from other desktops at the end of the list of icon themes.
- Since
- 3.1
Definition at line 351 of file kiconloader.cpp.
◆ alphaBlending()
bool TDEIconLoader::alphaBlending | ( | TDEIcon::Group | group | ) | const |
Checks whether the user wants to blend the icons with the background using the alpha channel information for a given group.
- Parameters
-
group the group to check
- Returns
- true if alpha blending is desired
Definition at line 1130 of file kiconloader.cpp.
◆ currentSize()
int TDEIconLoader::currentSize | ( | TDEIcon::Group | group | ) | const |
Returns the current size of the group.
- Parameters
-
group the group to check.
- Returns
- the current size for an icon group.
Definition at line 1012 of file kiconloader.cpp.
◆ enableDelayedIconSetLoading()
void TDEIconLoader::enableDelayedIconSetLoading | ( | bool | enable | ) |
Enables on-demand icon loading for QIconSets using TQIconFactory.
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 TDEIconLoader objects). Every TDEInstance 's iconloader has this feature enabled.
- Parameters
-
enable true to enable delayed icon loading, false to disable
- See also
- isDelayedIconSetLoadingEnabled()
- QIconFactory
- Since
- 3.1
Definition at line 289 of file kiconloader.cpp.
◆ extraDesktopThemesAdded()
bool TDEIconLoader::extraDesktopThemesAdded | ( | ) | const |
Returns if the default icon themes of other desktops have been added to the list of icon themes where icons are searched.
- Since
- 3.1
Definition at line 402 of file kiconloader.cpp.
◆ iconEffect()
TDEIconEffect * TDEIconLoader::iconEffect | ( | ) | const |
Returns a pointer to the TDEIconEffect object used by the icon loader.
- Returns
- the TDEIconEffect.
Definition at line 1125 of file kiconloader.cpp.
◆ iconPath()
TQString TDEIconLoader::iconPath | ( | const TQString & | name, |
int | group_or_size, | ||
bool | canReturnNull = false |
||
) | const |
Returns the path of an icon.
- Parameters
-
name The name of the icon, without extension. If an absolute path is supplied for this parameter, iconPath will return it directly. 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
. See TDEIcon::Group and TDEIcon::StdSizescanReturnNull Can 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
.
Definition at line 516 of file kiconloader.cpp.
◆ isDelayedIconSetLoadingEnabled()
bool TDEIconLoader::isDelayedIconSetLoadingEnabled | ( | ) | const |
Checks whether delayed loading for TQIconSet is enabled.
- Returns
- whether icons for QIconSets will be loaded on demand.
- See also
- enableDelayedIconSetLoading()
- QIconFactory
- Since
- 3.1
Definition at line 294 of file kiconloader.cpp.
◆ loadAnimated()
TQStringList TDEIconLoader::loadAnimated | ( | const TQString & | name, |
TDEIcon::Group | group, | ||
int | size = 0 |
||
) | const |
Loads an animated icon as a series of still frames.
If you want to load a .mng animation as TQMovie instead, please use loadMovie() instead.
- Parameters
-
name The name of the icon. group The icon group. See loadIcon(). size Override the default size for group
. See TDEIcon::StdSizes.
- Returns
- A TQStringList containing the absolute path of all the frames making up the animation.
Definition at line 955 of file kiconloader.cpp.
◆ loadIcon()
TQPixmap TDEIconLoader::loadIcon | ( | const TQString & | name, |
TDEIcon::Group | group, | ||
int | size = 0 , |
||
int | state = TDEIcon::DefaultState , |
||
TQString * | path_store = 0L , |
||
bool | canReturnNull = false |
||
) | 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
-
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
. See TDEIcon::StdSizes.state The icon state: DefaultState
,ActiveState
orDisabledState
. 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.
- Returns
- the TQPixmap. Can be null when not found, depending on
canReturnNull
.
Definition at line 583 of file kiconloader.cpp.
◆ loadIconSet() [1/3]
TQIconSet TDEIconLoader::loadIconSet | ( | const TQString & | name, |
TDEIcon::Group | group, | ||
int | size, | ||
bool | canReturnNull | ||
) |
Creates an icon set, that will do on-demand loading of the icon.
Loading itself is done by calling loadIcon .
- 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
. See TDEIcon::StdSizes.canReturnNull Can 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
.
- Since
- 3.1
Definition at line 1142 of file kiconloader.cpp.
◆ loadIconSet() [2/3]
TQIconSet TDEIconLoader::loadIconSet | ( | const TQString & | name, |
TDEIcon::Group | group, | ||
int | size, | ||
bool | canReturnNull, | ||
bool | immediateExistenceCheck | ||
) |
Creates an icon set, that will do on-demand loading of the icon.
Loading itself is done by calling loadIcon .
- 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
. See TDEIcon::StdSizes.canReturnNull Can return a null iconset? If false, iconset containing the "unknown" pixmap is returned when no appropriate icon has been found. immediateExistenceCheck If true on-demand icon loading will be disabled for canReturnNull and a null iconset may be returned immediately
- Returns
- the icon set. Can be null when not found, depending on
canReturnNull
.
- Since
- 3.5
Definition at line 1172 of file kiconloader.cpp.
◆ loadIconSet() [3/3]
TQIconSet TDEIconLoader::loadIconSet | ( | const TQString & | name, |
TDEIcon::Group | group, | ||
int | size = 0 |
||
) |
Creates an icon set, that will do on-demand loading of the icon.
Loading itself is done by calling loadIcon .
- 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
. See TDEIcon::StdSizes.
- Returns
- the icon set. Can be null when not found
Definition at line 1147 of file kiconloader.cpp.
◆ loadMovie()
TQMovie TDEIconLoader::loadMovie | ( | const TQString & | name, |
TDEIcon::Group | group, | ||
int | size = 0 |
||
) | const |
Loads an animated icon.
- Parameters
-
name The name of the icon. group The icon group. See loadIcon(). size Override the default size for group
. See TDEIcon::StdSizes.
- Returns
- A TQMovie object. Can be null if not found.
Definition at line 899 of file kiconloader.cpp.
◆ moviePath()
TQString TDEIconLoader::moviePath | ( | const TQString & | name, |
TDEIcon::Group | group, | ||
int | size = 0 |
||
) | const |
Returns the path to an animated icon.
- Parameters
-
name The name of the icon. group The icon group. See loadIcon(). size Override the default size for group
. See TDEIcon::StdSizes.
- Returns
- the full path to the movie, ready to be passed to QMovie's constructor. Empty string if not found.
Definition at line 911 of file kiconloader.cpp.
◆ queryIcons()
TQStringList TDEIconLoader::queryIcons | ( | int | group_or_size, |
TDEIcon::Context | context = TDEIcon::Any |
||
) | const |
Queries all available icons for a specific group, having a specific context.
- Parameters
-
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
. See TDEIcon::Group and TDEIcon::StdSizescontext The icon context.
- Returns
- a list of all icons
Definition at line 1076 of file kiconloader.cpp.
◆ queryIconsByContext()
TQStringList TDEIconLoader::queryIconsByContext | ( | int | group_or_size, |
TDEIcon::Context | context = TDEIcon::Any |
||
) | const |
Queries 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. Positive numbers are groups, negative numbers are negated sizes. See TDEIcon::Group and TDEIcon::StdSizes context The icon context.
- Returns
- A TQStringList containing the icon names available for that context
Definition at line 1035 of file kiconloader.cpp.
◆ queryIconsByDir()
TQStringList TDEIconLoader::queryIconsByDir | ( | const TQString & | iconsDir | ) | const |
Returns a list of all icons (*.png or *.xpm extension) in the given directory.
- Parameters
-
iconsDir the directory to search in
- Returns
- A TQStringList containing the icon paths
- Since
- 3.1
Definition at line 1024 of file kiconloader.cpp.
◆ reconfigure()
void TDEIconLoader::reconfigure | ( | const TQString & | _appname, |
TDEStandardDirs * | _dirs | ||
) |
Called by TDEInstance::newIconLoader to reconfigure the icon loader.
- Parameters
-
_appname the new application name _dirs the new standard directories. If 0, the directories from TDEGlobal will be taken.
Definition at line 166 of file kiconloader.cpp.
◆ theme()
TDEIconTheme * TDEIconLoader::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.
Definition at line 1006 of file kiconloader.cpp.
◆ unknown()
|
static |
Returns the unknown icon.
An icon that is used when no other icon can be found.
- Returns
- the unknown pixmap
Definition at line 1392 of file kiconloader.cpp.
Friends And Related Function Documentation
◆ BarIcon() [1/2]
|
related |
Load a toolbar icon.
Definition at line 1315 of file kiconloader.cpp.
◆ BarIcon() [2/2]
|
related |
Load a toolbar icon.
Definition at line 1322 of file kiconloader.cpp.
◆ BarIconSet()
|
related |
Load a toolbar icon, and apply the necessary effects to get an IconSet.
Definition at line 1327 of file kiconloader.cpp.
◆ DesktopIcon() [1/2]
|
related |
Load a desktop icon.
Definition at line 1297 of file kiconloader.cpp.
◆ DesktopIcon() [2/2]
|
related |
Load a desktop icon.
Definition at line 1304 of file kiconloader.cpp.
◆ DesktopIconSet()
|
related |
Load a desktop icon, and apply the necessary effects to get an IconSet.
Definition at line 1309 of file kiconloader.cpp.
◆ IconSize()
|
related |
Returns the current icon size for a specific group.
Definition at line 1386 of file kiconloader.cpp.
◆ MainBarIcon() [1/2]
|
related |
Load a main toolbar icon.
Definition at line 1351 of file kiconloader.cpp.
◆ MainBarIcon() [2/2]
|
related |
Load a main toolbar icon.
Definition at line 1358 of file kiconloader.cpp.
◆ MainBarIconSet()
|
related |
Load a main toolbar icon, and apply the effects to get an IconSet.
Definition at line 1363 of file kiconloader.cpp.
◆ SmallIcon() [1/2]
|
related |
Load a small icon.
Definition at line 1333 of file kiconloader.cpp.
◆ SmallIcon() [2/2]
|
related |
Load a small icon.
Definition at line 1340 of file kiconloader.cpp.
◆ SmallIconSet()
|
related |
Load a small icon, and apply the necessary effects to get an IconSet.
Definition at line 1345 of file kiconloader.cpp.
◆ UserIcon() [1/2]
|
related |
Load a user icon.
User icons are searched in $appdir/pics.
Definition at line 1369 of file kiconloader.cpp.
◆ UserIcon() [2/2]
|
related |
Load a user icon.
User icons are searched in $appdir/pics.
Definition at line 1375 of file kiconloader.cpp.
◆ UserIconSet()
|
related |
Load a user icon, and apply the effects to get an IconSet.
Definition at line 1380 of file kiconloader.cpp.
The documentation for this class was generated from the following files: