#pragma once #include #include class GIconImpl : public RefCounted { public: static NonnullRefPtr create() { return adopt(*new GIconImpl); } ~GIconImpl() {} const GraphicsBitmap* bitmap_for_size(int) const; void set_bitmap_for_size(int, RefPtr&&); private: GIconImpl() {} HashMap> m_bitmaps; }; class GIcon { public: GIcon(); explicit GIcon(RefPtr&&); explicit GIcon(RefPtr&&, RefPtr&&); explicit GIcon(const GIconImpl&); GIcon(const GIcon&); ~GIcon() {} static GIcon default_icon(const StringView&); GIcon& operator=(const GIcon& other) { if (this != &other) m_impl = other.m_impl; return *this; } const GraphicsBitmap* bitmap_for_size(int size) const { return m_impl->bitmap_for_size(size); } void set_bitmap_for_size(int size, RefPtr&& bitmap) { m_impl->set_bitmap_for_size(size, move(bitmap)); } const GIconImpl& impl() const { return *m_impl; } private: NonnullRefPtr m_impl; };