psychic-ui 0.0.0
Loading...
Searching...
No Matches
psychic_ui::IconRegistry Class Reference

#include <IconRegistry.hpp>

Public Member Functions

 IconRegistry ()=default
 IconRegistry (std::initializer_list< std::span< const IconDefinition > > sets)
IconRegistry & add (const IconDefinition &definition)
IconRegistry & add (std::span< const IconDefinition > set)
bool has (std::string_view name) const
std::vector< std::string_view > names () const
std::size_t size () const
const IconShape * shape (std::string_view name)

Static Public Member Functions

static IconRegistry & shared ()

Detailed Description

The icons, by name: the bundled sets, then what the application adds.

Path data is parsed once, the first time an icon is drawn, and its paths are kept. An unknown name, or path data that doesn't parse, draws nothing and is reported once on stderr.

Constructor & Destructor Documentation

◆ IconRegistry()

psychic_ui::IconRegistry::IconRegistry ( )
default

An empty registry, or one with the given sets, registered in order

Member Function Documentation

◆ add() [1/2]

IconRegistry & psychic_ui::IconRegistry::add ( const IconDefinition & definition)

Registers an icon (copying its data), replacing the one of that name if there is one

◆ add() [2/2]

IconRegistry & psychic_ui::IconRegistry::add ( std::span< const IconDefinition > set)

Registers every icon of a set

◆ names()

std::vector< std::string_view > psychic_ui::IconRegistry::names ( ) const

The names, in registration order

◆ shape()

const IconShape * psychic_ui::IconRegistry::shape ( std::string_view name)

The icon's paths, parsed on first use; nullptr for an unknown name or unparsable data (reported once)

◆ shared()

IconRegistry & psychic_ui::IconRegistry::shared ( )
static

The registry Icon and paint::icon draw from, with the bundled sets


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