1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

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)
This commit is contained in:
Shannon Booth 2020-03-07 12:02:21 +13:00 committed by Andreas Kling
parent 57f1c919df
commit 6a3b12664a
24 changed files with 120 additions and 104 deletions

View file

@ -31,31 +31,33 @@
#include <AK/RefCounted.h>
#include <LibGfx/Forward.h>
class GIconImpl : public RefCounted<GIconImpl> {
namespace GUI {
class IconImpl : public RefCounted<IconImpl> {
public:
static NonnullRefPtr<GIconImpl> create() { return adopt(*new GIconImpl); }
~GIconImpl() {}
static NonnullRefPtr<IconImpl> create() { return adopt(*new IconImpl); }
~IconImpl() {}
const Gfx::Bitmap* bitmap_for_size(int) const;
void set_bitmap_for_size(int, RefPtr<Gfx::Bitmap>&&);
private:
GIconImpl() {}
IconImpl() {}
HashMap<int, RefPtr<Gfx::Bitmap>> m_bitmaps;
};
class GIcon {
class Icon {
public:
GIcon();
explicit GIcon(RefPtr<Gfx::Bitmap>&&);
explicit GIcon(RefPtr<Gfx::Bitmap>&&, RefPtr<Gfx::Bitmap>&&);
explicit GIcon(const GIconImpl&);
GIcon(const GIcon&);
~GIcon() {}
Icon();
explicit Icon(RefPtr<Gfx::Bitmap>&&);
explicit Icon(RefPtr<Gfx::Bitmap>&&, RefPtr<Gfx::Bitmap>&&);
explicit Icon(const IconImpl&);
Icon(const Icon&);
~Icon() {}
static GIcon default_icon(const StringView&);
static Icon default_icon(const StringView&);
GIcon& operator=(const GIcon& other)
Icon& operator=(const Icon& other)
{
if (this != &other)
m_impl = other.m_impl;
@ -65,8 +67,10 @@ public:
const Gfx::Bitmap* bitmap_for_size(int size) const { return m_impl->bitmap_for_size(size); }
void set_bitmap_for_size(int size, RefPtr<Gfx::Bitmap>&& bitmap) { m_impl->set_bitmap_for_size(size, move(bitmap)); }
const GIconImpl& impl() const { return *m_impl; }
const IconImpl& impl() const { return *m_impl; }
private:
NonnullRefPtr<GIconImpl> m_impl;
NonnullRefPtr<IconImpl> m_impl;
};
}