// // Created by versustune on 17.03.20. // #include "BaseComponent.h" #include 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(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(); 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); }