XDGKit v0.1.0-1
XDG Utilities for C++
Loading...
Searching...
No Matches
Public Member Functions | List of all members
XDGIconTheme Class Reference

An icon theme. More...

#include <XDGIconTheme.h>

Public Member Functions

XDGKitkit () const noexcept
 Handle to the parent kit.
 
bool initialized () const noexcept
 Verifies whether the theme has been loaded.
 
const std::string & name () const noexcept
 Retrieves the theme's directory base name.
 
const std::string & displayName () const noexcept
 Retrieves the theme's display name.
 
const std::string & comment () const noexcept
 Retrieves the theme's long name or comment.
 
const std::vector< std::string > & inherits () const noexcept
 Retrieves themes inherited by this theme.
 
const std::string & example () const noexcept
 Retrieves an example icon name associated with this theme.
 
bool hidden () const noexcept
 Checks whether the theme is hidden.
 
const std::filesystem::path & indexFilePath () const noexcept
 Retrieves the path to the first index.theme file found in the theme's directories.
 
const std::vector< std::filesystem::path > & dirs () const noexcept
 Retrieves all directories where this theme was found.
 
const XDGINIindexData () const noexcept
 Retrieves the parsed index.theme data.
 
void freeIndexData () noexcept
 Clears the contents of indexData().
 
const std::vector< std::shared_ptr< XDGIconDirectory > > & iconDirectories () const noexcept
 Retrieves the directories containing normal icons.
 
const std::vector< std::shared_ptr< XDGIconDirectory > > & scaledIconDirectories () const noexcept
 Retrieves the directories containing scaled icons.
 

Detailed Description

An icon theme.

This class encapsulates the properties and data of an icon theme, including its name, directories, fallback themes, and associated metadata.

Icon themes are loaded lazily. The loading typically occurs whenever XDGIconThemeManager::findIcon() attempts to access iconDirectories() or scaledIconDirectories() for the first time.

Member Function Documentation

◆ kit()

XDGKit & kit ( ) const
inlinenoexcept

Handle to the parent kit.

◆ initialized()

bool initialized ( ) const
inlinenoexcept

Verifies whether the theme has been loaded.

The theme is loaded lazily when either iconDirectories() or scaledIconDirectories() is accessed for the first time.

◆ name()

const std::string & name ( ) const
inlinenoexcept

Retrieves the theme's directory base name.

Returns
A constant reference to the theme's base name.

◆ displayName()

const std::string & displayName ( ) const
inlinenoexcept

Retrieves the theme's display name.

Returns
A constant reference to the theme's display name.

◆ comment()

const std::string & comment ( ) const
inlinenoexcept

Retrieves the theme's long name or comment.

Returns
A constant reference to the theme's comment.

◆ inherits()

const std::vector< std::string > & inherits ( ) const
inlinenoexcept

Retrieves themes inherited by this theme.

Inherited themes are used as fallback if an icon is not found in this theme.

Returns
A constant reference to a vector of inherited theme names.

◆ example()

const std::string & example ( ) const
inlinenoexcept

Retrieves an example icon name associated with this theme.

Used as a preview of the theme for icon theme selection panels.

Returns
A constant reference to the example icon name.

◆ hidden()

bool hidden ( ) const
inlinenoexcept

Checks whether the theme is hidden.

Hidden themes should not be displayed as options in icon theme selection panels.

Returns
true if the theme is hidden, otherwise false.

◆ indexFilePath()

const std::filesystem::path & indexFilePath ( ) const
inlinenoexcept

Retrieves the path to the first index.theme file found in the theme's directories.

Returns
A constant reference to the path of the index.theme file.

◆ dirs()

const std::vector< std::filesystem::path > & dirs ( ) const
inlinenoexcept

Retrieves all directories where this theme was found.

Returns
A constant reference to a vector of directories associated with this theme.

◆ indexData()

const XDGINI & indexData ( ) const
inlinenoexcept

Retrieves the parsed index.theme data.

Returns
A constant reference to the parsed data stored in an XDGINI object.

◆ freeIndexData()

void freeIndexData ( )
inlinenoexcept

Clears the contents of indexData().

This method releases the information of the loaded index.theme when it is no longer needed. This doesn't affect properties such as name(), displayName(), comment(), ext.

Note
Calling this method on an uninitialized theme has no effect.

◆ iconDirectories()

const std::vector< std::shared_ptr< XDGIconDirectory > > & iconDirectories ( ) const
inlinenoexcept

Retrieves the directories containing normal icons.

Returns
A constant reference to a vector of icon directories.

◆ scaledIconDirectories()

const std::vector< std::shared_ptr< XDGIconDirectory > > & scaledIconDirectories ( ) const
inlinenoexcept

Retrieves the directories containing scaled icons.

Returns
A constant reference to a vector of scaled icon directories.