Initial commit.

This commit is contained in:
jmsgrogan 2020-05-02 08:31:03 +01:00
commit 59c6161fdb
134 changed files with 4751 additions and 0 deletions

View file

@ -0,0 +1,35 @@
#include "Label.h"
#include "TextElement.h"
Label::Label()
: Widget(),
mLabel()
{
}
std::shared_ptr<Label> Label::Create()
{
return std::make_shared<Label>();
}
void Label::SetLabel(const std::string& text)
{
mLabel = text;
}
void Label::OnPaintEvent(PaintEventPtr event)
{
mLayers.clear();
AddBackground(event);
if(!mLabel.empty())
{
auto middle = DiscretePoint(mLocation.GetX() + mWidth/2,
mLocation.GetY() + mHeight/2);
auto text = TextElement::Create(mLabel, middle);
auto textLayer = VisualLayer::Create();
textLayer->SetText(text);
mLayers.push_back(textLayer);
}
}