summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-12-16 11:53:23 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-16 11:53:23 +0100
commit3d5e30a1e627b9f4558e41f5f720a1fda892993f (patch)
tree66264606c2def1f02082f6d3ce3cfd2580ea7351
parenteb7a94364188740d67278c74bc17d4223697becd (diff)
downloadserenity-3d5e30a1e627b9f4558e41f5f720a1fda892993f.zip
LibGUI: Add GUI::Icon::sizes()
This gives you a Vector<int> with all the sizes contained in the Icon.
-rw-r--r--Libraries/LibGUI/Icon.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Libraries/LibGUI/Icon.h b/Libraries/LibGUI/Icon.h
index 2f18ba3456..7aedbe2938 100644
--- a/Libraries/LibGUI/Icon.h
+++ b/Libraries/LibGUI/Icon.h
@@ -41,6 +41,14 @@ public:
const Gfx::Bitmap* bitmap_for_size(int) const;
void set_bitmap_for_size(int, RefPtr<Gfx::Bitmap>&&);
+ Vector<int> sizes() const
+ {
+ Vector<int> sizes;
+ for (auto& it : m_bitmaps)
+ sizes.append(it.key);
+ return sizes;
+ }
+
private:
IconImpl() { }
HashMap<int, RefPtr<Gfx::Bitmap>> m_bitmaps;
@@ -69,6 +77,8 @@ public:
const IconImpl& impl() const { return *m_impl; }
+ Vector<int> sizes() const { return m_impl->sizes(); }
+
private:
NonnullRefPtr<IconImpl> m_impl;
};