2020-04-03 13:23:19 +02:00
|
|
|
//
|
|
|
|
// Created by versustune on 17.03.20.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "BaseComponent.h"
|
2020-06-13 10:56:20 +02:00
|
|
|
#include "../../Fonts/Fonts.h"
|
2020-06-08 21:27:17 +02:00
|
|
|
#include <utility>
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
BaseComponent::BaseComponent (const std::string& processId)
|
|
|
|
{
|
2020-06-13 10:56:20 +02:00
|
|
|
m_processId = processId;
|
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
BaseComponent::~BaseComponent ()
|
|
|
|
{
|
|
|
|
m_label.reset ();
|
2020-06-08 21:27:17 +02:00
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
void BaseComponent::addLabel (const std::string& label_text, LabelPosition labelPosition)
|
|
|
|
{
|
2020-06-08 21:27:17 +02:00
|
|
|
m_enableLabel = true;
|
2020-06-13 16:52:16 +02:00
|
|
|
m_label = std::make_shared<LabelComponent> (this, label_text);
|
|
|
|
m_label->setPosition (labelPosition);
|
2020-06-08 21:27:17 +02:00
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
void BaseComponent::resized ()
|
|
|
|
{
|
|
|
|
if (m_enableLabel && m_label != nullptr)
|
|
|
|
{
|
|
|
|
LabelPosition position = m_label->getLabelPosition ();
|
|
|
|
if (position == LabelPosition::TOP)
|
|
|
|
{
|
|
|
|
m_label->setBounds (0, 0, getWidth (), 15);
|
|
|
|
}
|
|
|
|
else if (position == LabelPosition::BOTTOM)
|
|
|
|
{
|
|
|
|
m_label->setBounds (0, getHeight () - 20, getWidth (), 15);
|
2020-06-08 21:27:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
void BaseComponent::paint (Graphics& g)
|
|
|
|
{
|
|
|
|
g.setFont (*VenoFonts::getNormal ());
|
2020-06-08 21:27:17 +02:00
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
void BaseComponent::setParameter (std::string name, std::string group)
|
|
|
|
{
|
|
|
|
m_name = std::move (name);
|
|
|
|
m_group = std::move (group);
|
|
|
|
setName (m_name);
|
2020-06-08 21:27:17 +02:00
|
|
|
}
|