abaddon-ppc/imgmanager.hpp

19 lines
491 B
C++
Raw Normal View History

2020-09-12 07:17:34 +00:00
#pragma once
#include <string>
#include <unordered_map>
#include <functional>
#include <gtkmm.h>
#include "filecache.hpp"
class ImageManager {
public:
Cache &GetCache();
void LoadFromURL(std::string url, std::function<void(Glib::RefPtr<Gdk::Pixbuf>)> cb);
Glib::RefPtr<Gdk::Pixbuf> GetFromURLIfCached(std::string url);
Glib::RefPtr<Gdk::Pixbuf> GetPlaceholder(int size);
2020-09-12 07:17:34 +00:00
private:
std::unordered_map<std::string, Glib::RefPtr<Gdk::Pixbuf>> m_pixs;
Cache m_cache;
};