2020-04-03 13:23:19 +02:00
|
|
|
//
|
|
|
|
// Created by versustune on 17.03.20.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "BaseComponent.h"
|
2020-06-08 21:27:17 +02:00
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
BaseComponent::~BaseComponent() {
|
|
|
|
m_label.reset();
|
|
|
|
setLookAndFeel(nullptr);
|
|
|
|
m_lookHandler.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseComponent::addLabel(const std::string &label_text, LabelPosition labelPosition) {
|
|
|
|
m_enableLabel = true;
|
|
|
|
m_label = std::make_shared<LabelComponent>(this, label_text);
|
|
|
|
m_label->setPosition(labelPosition);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseComponent::paint(Graphics &g) {
|
|
|
|
}
|
|
|
|
|
|
|
|
BaseComponent::BaseComponent() {
|
|
|
|
m_lookHandler = std::make_shared<LookHandler>();
|
|
|
|
setLookAndFeel(m_lookHandler->getLook());
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseComponent::setParameter(std::string name, std::string group) {
|
|
|
|
m_name = std::move(name);
|
|
|
|
m_group = std::move(group);
|
|
|
|
setName(m_name);
|
|
|
|
}
|