API Documentation
Public Member Functions | List of all members
nkWinUi::ThemeManager Class Referencefinal

Manages the themes within the component. More...

Inheritance diagram for nkWinUi::ThemeManager:

Public Member Functions

SystemgetSystem () const
 
ThemegetActiveTheme () const
 
void setActiveTheme (Theme *theme)
 
ThemecreateOrRetrieve (nkMemory::StringView name)
 
Themerecord (nkMemory::StringView name, nkMemory::UniquePtr< Theme > resource)
 
Themeget (nkMemory::StringView name) const
 
ThemegetByIndex (unsigned int index) const
 
void rename (nkMemory::StringView currentName, nkMemory::StringView newName)
 
void erase (nkMemory::StringView name)
 
nkMemory::UniquePtr< Themerelinquish (nkMemory::StringView name)
 

Detailed Description

Manages the themes within the component.

A Manager is always responsible for the resources allocated using it.

Member Function Documentation

◆ getSystem()

System* nkWinUi::ThemeManager::getSystem ( ) const
Returns
The system the manager is living in.

◆ getActiveTheme()

Theme* nkWinUi::ThemeManager::getActiveTheme ( ) const
Returns
The theme currently active.

◆ setActiveTheme()

void nkWinUi::ThemeManager::setActiveTheme ( Theme theme)

Sets the active theme to use within the component.

Parameters
themeThe theme to use when drawing the windows in the component.

◆ createOrRetrieve()

Theme* nkWinUi::ThemeManager::createOrRetrieve ( nkMemory::StringView  name)

Creates if unavailable, or retrieve if available, a theme.

Parameters
nameThe name of the theme to retrieve.
Returns
A newly created theme if it was previously unavailable, or the theme already attached to the name if available.

◆ record()

Theme* nkWinUi::ThemeManager::record ( nkMemory::StringView  name,
nkMemory::UniquePtr< Theme resource 
)

Records an already existing resource in the manager, passing its ownership around.

Parameters
nameThe name under which the resource should be recorded.
resourceThe resource to record.
Returns
A raw pointer over the resource, now recorded in the manager.

◆ get()

Theme* nkWinUi::ThemeManager::get ( nkMemory::StringView  name) const

Request for a theme attached to a name.

Parameters
nameThe name of the theme wanted.
Returns
The Theme attached to the name if available, nullptr otherwise.

◆ getByIndex()

Theme* nkWinUi::ThemeManager::getByIndex ( unsigned int  index) const

Returns the resource at given index, if available.

Parameters
indexThe index of the resource to retrieve.
Returns
The resource attached to given index.
Remarks
An index refers to the index in the manager's container, so one index can be attached through different resources depending on allocations. This method is meant to loop on all resources in one go, because of this.

◆ rename()

void nkWinUi::ThemeManager::rename ( nkMemory::StringView  currentName,
nkMemory::StringView  newName 
)

Renames a resource.

Parameters
currentNameThe name of the resource to rename.
newNameThe name to reassign to the resource.

◆ erase()

void nkWinUi::ThemeManager::erase ( nkMemory::StringView  name)

Erases a resource. Memory attached to it will be freed.

Parameters
nameThe name identifying the resource to erase.

◆ relinquish()

nkMemory::UniquePtr<Theme> nkWinUi::ThemeManager::relinquish ( nkMemory::StringView  name)

Requests the manager to relinquish the ownership of a resource and pass it around.

Parameters
nameThe name of the recorded resource to relinquish.
Returns
The ownership over the resource requested if available, nullptr otherwise.

The documentation for this class was generated from the following file: