#include "icons.h" #include "global.h" const wxBitmap* IconCache::GetIcon(const std::string& filename, wxSize size) { std::tuple key = {filename, size.x, size.y}; if (!icons_.count(key)) { icons_[key] = wxBitmap(wxImage(GetAbsolutePath(filename).c_str(), wxBITMAP_TYPE_PNG) .Scale(size.x, size.y)); } return &icons_.at(key); } static IconCache* ICON_CACHE_INSTANCE = nullptr; void SetTheIconCache(IconCache* instance) { ICON_CACHE_INSTANCE = instance; } IconCache& GetTheIconCache() { return *ICON_CACHE_INSTANCE; }