mousetrap v0.2.0
Loading...
Searching...
No Matches
mousetrap::Icon Class Reference

object representing an icon. Note that this does not hodl any image data, instead it points to a file on disk or to an entry in an mousetrap::IconTheme More...

#include <icon.hpp>

Public Member Functions

 Icon ()
 construct as empty icon
 
 ~Icon ()
 destructor
 
 operator GIcon * () const
 expose as GIcon \for_internal_use_only
 
 operator GtkIconPaintable * () const
 expose as GtkIconPaintable \for_internal_use_only
 
bool create_from_file (const std::string &path, uint64_t square_resolution, uint64_t scale=1)
 create icon from file
 
bool create_from_theme (const IconTheme &theme, const IconID &, uint64_t square_resolution, uint64_t scale=1)
 create icon from theme
 
IconID get_name () const
 get the identifier of the icon
 
bool operator== (const Icon &other) const
 check if two icons point to the same resource
 
bool operator!= (const Icon &other) const
 check if two icons point to the same resource
 
uint64_t get_scale () const
 get icon scale
 
Vector2ui get_size () const
 get icon resolution, this is the resolution requested during create_from, not the resources native resolution
 

Detailed Description

object representing an icon. Note that this does not hodl any image data, instead it points to a file on disk or to an entry in an mousetrap::IconTheme

Member Function Documentation

◆ create_from_file()

bool mousetrap::Icon::create_from_file ( const std::string &  path,
uint64_t  square_resolution,
uint64_t  scale = 1 
)

create icon from file

Parameters
path
square_resolutiontarget size of the icon, icons are always square. If the file is not a .svg file and the native resolution of the image is different from the requested resolution, performss linear scaling
scalescale of the icon, or 1 for no scaling

References mousetrap::log::critical().

◆ create_from_theme()

bool mousetrap::Icon::create_from_theme ( const IconTheme theme,
const IconID &  id,
uint64_t  square_resolution,
uint64_t  scale = 1 
)

create icon from theme

Parameters
theme
idid of an icon
square_resolutiontarget size of the icon, icons are always square. If the file is not a .svg file and the native resolution of the image is different from the requested resolution, performss linear scaling
scalescale of the icon, or 1 for no scaling

References mousetrap::log::critical().

◆ get_name()

IconID mousetrap::Icon::get_name ( ) const

get the identifier of the icon

Returns
id

◆ get_scale()

uint64_t mousetrap::Icon::get_scale ( ) const

get icon scale

Returns
scale

Referenced by mousetrap::ImageDisplay::create_from_icon().

◆ get_size()

Vector2ui mousetrap::Icon::get_size ( ) const

get icon resolution, this is the resolution requested during create_from, not the resources native resolution

Returns
resolution

Referenced by mousetrap::ImageDisplay::create_from_icon().

◆ operator!=()

bool mousetrap::Icon::operator!= ( const Icon other) const

check if two icons point to the same resource

Parameters
other
Returns
false if both icons point to the same resource, true otherwise

◆ operator==()

bool mousetrap::Icon::operator== ( const Icon other) const

check if two icons point to the same resource

Parameters
other
Returns
true if both icons point to the same resource, false otherwise

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