#include "IconNode.h"

#include "SvgNode.h"

IconNode::IconNode(const Transform& transform)
	: AbstractVisualNode(transform)
{

}

unsigned IconNode::getContentWidth() const
{
	return mSvgContent->getContentWidth();
}

unsigned IconNode::getContentHeight() const
{
	return mSvgContent->getContentHeight();
}

void IconNode::setSvgContent(std::unique_ptr<SvgNode> svg_node)
{
	mChildren.clear();

	mType = IconType::Svg;

	mSvgContent = std::move(svg_node);
	mContentDirty = true;

	addChild(mSvgContent.get());
}

void IconNode::setFillColor(const Color& color)
{
	if (mType == IconType::Svg)
	{
		mSvgContent->setFillColor(color);
		mSvgContent->setHasStrokeColor(false);
	}
}

void IconNode::setOutlineColor(const Color& color)
{
	if (mType == IconType::Svg)
	{
		mSvgContent->setStrokeColor(color);
	}
}