summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/Icon.cpp
diff options
context:
space:
mode:
authorShannon Booth <shannon.ml.booth@gmail.com>2020-03-07 12:02:21 +1300
committerAndreas Kling <kling@serenityos.org>2020-03-07 01:33:53 +0100
commit6a3b12664a7ce85bef93497df70c0b96cfc509d0 (patch)
tree0af568a218003c41a86d2c8ba5bc1a35bc77cb89 /Libraries/LibGUI/Icon.cpp
parent57f1c919df4d755790f6ac1e4797ab514d436f9a (diff)
downloadserenity-6a3b12664a7ce85bef93497df70c0b96cfc509d0.zip
LibGUI: Move Icon and FontDatabase into the GUI namespace
We also clean up some old references to the old G prefixed GUI classes This also fixes a potential bug with using: C_OBJECT_ABSTRACT(GAbstractButton) instead of C_OBJECT_ABSTRACT(AbstractButton)
Diffstat (limited to 'Libraries/LibGUI/Icon.cpp')
-rw-r--r--Libraries/LibGUI/Icon.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/Libraries/LibGUI/Icon.cpp b/Libraries/LibGUI/Icon.cpp
index cd60552155..a6f1254a17 100644
--- a/Libraries/LibGUI/Icon.cpp
+++ b/Libraries/LibGUI/Icon.cpp
@@ -28,23 +28,25 @@
#include <LibGUI/Icon.h>
#include <LibGfx/Bitmap.h>
-GIcon::GIcon()
- : m_impl(GIconImpl::create())
+namespace GUI {
+
+Icon::Icon()
+ : m_impl(IconImpl::create())
{
}
-GIcon::GIcon(const GIconImpl& impl)
- : m_impl(const_cast<GIconImpl&>(impl))
+Icon::Icon(const IconImpl& impl)
+ : m_impl(const_cast<IconImpl&>(impl))
{
}
-GIcon::GIcon(const GIcon& other)
+Icon::Icon(const Icon& other)
: m_impl(other.m_impl)
{
}
-GIcon::GIcon(RefPtr<Gfx::Bitmap>&& bitmap)
- : GIcon()
+Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap)
+ : Icon()
{
if (bitmap) {
ASSERT(bitmap->width() == bitmap->height());
@@ -53,8 +55,8 @@ GIcon::GIcon(RefPtr<Gfx::Bitmap>&& bitmap)
}
}
-GIcon::GIcon(RefPtr<Gfx::Bitmap>&& bitmap1, RefPtr<Gfx::Bitmap>&& bitmap2)
- : GIcon(move(bitmap1))
+Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap1, RefPtr<Gfx::Bitmap>&& bitmap2)
+ : Icon(move(bitmap1))
{
if (bitmap2) {
ASSERT(bitmap2->width() == bitmap2->height());
@@ -63,7 +65,7 @@ GIcon::GIcon(RefPtr<Gfx::Bitmap>&& bitmap1, RefPtr<Gfx::Bitmap>&& bitmap2)
}
}
-const Gfx::Bitmap* GIconImpl::bitmap_for_size(int size) const
+const Gfx::Bitmap* IconImpl::bitmap_for_size(int size) const
{
auto it = m_bitmaps.find(size);
if (it != m_bitmaps.end())
@@ -81,7 +83,7 @@ const Gfx::Bitmap* GIconImpl::bitmap_for_size(int size) const
return best_fit;
}
-void GIconImpl::set_bitmap_for_size(int size, RefPtr<Gfx::Bitmap>&& bitmap)
+void IconImpl::set_bitmap_for_size(int size, RefPtr<Gfx::Bitmap>&& bitmap)
{
if (!bitmap) {
m_bitmaps.remove(size);
@@ -90,9 +92,11 @@ void GIconImpl::set_bitmap_for_size(int size, RefPtr<Gfx::Bitmap>&& bitmap)
m_bitmaps.set(size, move(bitmap));
}
-GIcon GIcon::default_icon(const StringView& name)
+Icon Icon::default_icon(const StringView& name)
{
auto bitmap16 = Gfx::Bitmap::load_from_file(String::format("/res/icons/16x16/%s.png", String(name).characters()));
auto bitmap32 = Gfx::Bitmap::load_from_file(String::format("/res/icons/32x32/%s.png", String(name).characters()));
- return GIcon(move(bitmap16), move(bitmap32));
+ return Icon(move(bitmap16), move(bitmap32));
+}
+
}