#include <Widget/IconLabel/IconLabel.hpp>
#include <Widget/Label/Label.hpp>
#include <Widget/Layout/CompoundWidget/DocIconTag/DocIconTag.hpp>

DocIconTag::DocIconTag(const std::vector<std::string> &args)
{
    if (args.size() != 2)
    {
        addChildren(new Label("<!!!>", Color::error));
        return;
    }

    Material *material = Material::byName(args[1]);
    if (material == NULL)
    {
        addChildren(new Label(formatString("Icon '$+' not found", args[1]), Color::error));
        return;
    }

    addChildren(
        new IconLabel(*material)
    );
}