<commit_before>#include "SimpleIcon.h"
#include <graphics/IconPack.h>
#include <graphics/Painter.h>

namespace MGUI
{

ilixi::IconPack* SimpleIcon::__iconPack = NULL;

SimpleIcon::SimpleIcon(Widget* parent)
        : Widget(parent),
          _image(NULL)
{
    setConstraints(ilixi::FixedConstraint, ilixi::FixedConstraint);
    if (!__iconPack)
        __iconPack = new ilixi::IconPack(DATADIR"/theme/IconPack.xml");
}

SimpleIcon::~SimpleIcon()
{
    delete _image;
}

ilixi::Size
SimpleIcon::preferredSize() const
{
    return ilixi::Size(24, 24);
}

void
SimpleIcon::setImage(const std::string& name)
{
    if (_image)
        delete _image;
    _image = __iconPack->getIcon(name);
    update();
}

void
SimpleIcon::compose(const ilixi::PaintEvent& event)
{
    if (_image)
    {
        ilixi::Painter p(this);
        p.begin(event);
        p.drawImage(_image, 0, 0);
        p.end();
    }
}

} /* namespace MGUI */<commit_msg>SimpleIcon: WakeUp main loop when image is set.<commit_after>#include "SimpleIcon.h"
#include <core/Engine.h>
#include <graphics/IconPack.h>
#include <graphics/Painter.h>

namespace MGUI
{

ilixi::IconPack* SimpleIcon::__iconPack = NULL;

SimpleIcon::SimpleIcon(Widget* parent)
        : Widget(parent),
          _image(NULL)
{
    setConstraints(ilixi::FixedConstraint, ilixi::FixedConstraint);
    if (!__iconPack)
        __iconPack = new ilixi::IconPack(DATADIR"/theme/IconPack.xml");
}

SimpleIcon::~SimpleIcon()
{
    delete _image;
}

ilixi::Size
SimpleIcon::preferredSize() const
{
    return ilixi::Size(24, 24);
}

void
SimpleIcon::setImage(const std::string& name)
{
    if (_image)
        delete _image;
    _image = __iconPack->getIcon(name);
    ilixi::Engine::instance().wakeUp();
    update();
}

void
SimpleIcon::compose(const ilixi::PaintEvent& event)
{
    if (_image)
    {
        ilixi::Painter p(this);
        p.begin(event);
        p.drawImage(_image, 0, 0);
        p.end();
    }
}

} /* namespace MGUI */
{'fraction_non_alphanumeric': 0.1506849315068493, 'fraction_numerical': 0.0060882800608828, 'mean_word_length': 3.6182669789227164, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6843177', 'n_tokens_mistral': 711, 'n_tokens_neox': 698, 'n_words': 124}