XDGKit v1.0.0-1
C++ XDG Utilities
|
Utility for finding icons. More...
#include <XDGIconThemeManager.h>
Public Member Functions | |
XDGKit & | kit () const noexcept |
Handle to the parent kit. | |
const std::vector< std::filesystem::path > & | searchDirs () const noexcept |
Retrieves the directories to search for icon themes, in order of precedence. | |
const XDGMap< std::string, std::shared_ptr< XDGIconTheme > > & | themes () const noexcept |
Retrieves all discovered icon themes. | |
bool | reloadThemes (bool onlyIfCacheChanged=false) noexcept |
Reloads all available themes. | |
const XDGIcon * | findIcon (const std::string &icon, int32_t size, int32_t scale=1, uint32_t extensions=XDGIcon::PNG|XDGIcon::SVG, const std::vector< std::string > &themes={ "" }, uint32_t contexts=XDGIconDirectory::AnyContext) noexcept |
Searches for an icon within the specified themes. | |
void | evictCache () noexcept |
Suggests to the OS to evict all mapped cache files from memory. | |
Utility for finding icons.
|
inlinenoexcept |
Handle to the parent kit.
|
inlinenoexcept |
Retrieves the directories to search for icon themes, in order of precedence.
The default search directories in order are:
|
inlinenoexcept |
Retrieves all discovered icon themes.
|
noexcept |
Reloads all available themes.
Scans the system and reloads all detected themes, replacing any previously loaded data.
Use this function when the set of themes has changed (e.g., after installation or removal).
onlyIfCacheChanged | If true , themes will only be reloaded if a change in the cache is detected. |
true
if themes were reloaded, false
otherwise.
|
noexcept |
Searches for an icon within the specified themes.
This function attempts to locate an icon that matches the provided criteria (name, size, scale, and extensions) within the given list of themes.
reloadThemes()
is called or when the XDGKit
instance is removed.icon | The name of the icon to search for. |
size | The desired nominal size of the icon. |
scale | The scale factor of the icon. Defaults to 1. |
extensions | Flags indicating the acceptable image file extensions. |
themes | A list of theme names to search, in the specified order. An empty string ("") serves as a placeholder to search in all themes available. |
contexts | Flags to limit the search to the given XDGIconDirectory::Context (s). |
nullptr
if no match is found.
|
noexcept |
Suggests to the OS to evict all mapped cache files from memory.
Use this function when themes are not expected to be used in the near future, helping to free up memory by prompting the OS to release the data.