Files
BloomPatched/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/PinWidget.hpp

62 lines
1.7 KiB
C++
Raw Normal View History

2021-04-04 21:04:12 +01:00
#pragma once
#include <QWidget>
#include <cstdint>
#include <QVBoxLayout>
2021-04-04 21:04:12 +01:00
#include <QLabel>
#include <QPainter>
2021-04-04 21:04:12 +01:00
#include "../TargetPinWidget.hpp"
2021-04-04 21:04:12 +01:00
#include "PinBodyWidget.hpp"
#include "src/Targets/TargetVariant.hpp"
namespace Bloom::Widgets::InsightTargetWidgets::Dip
2021-04-04 21:04:12 +01:00
{
2022-03-01 20:35:56 +00:00
enum class Position: std::uint8_t
{
TOP,
BOTTOM
};
2021-04-04 21:04:12 +01:00
class PinWidget: public TargetPinWidget
{
Q_OBJECT
2021-04-04 21:04:12 +01:00
public:
2021-11-20 19:08:35 +00:00
static constexpr int MINIMUM_WIDTH = PinBodyWidget::WIDTH;
static constexpr int WIDTH_SPACING = 4;
static constexpr int PIN_LABEL_SPACING = 2;
static constexpr int PIN_LABEL_LONG_LINE_LENGTH = 25;
static constexpr int PIN_LABEL_SHORT_LINE_LENGTH = 5;
static constexpr int LABEL_HEIGHT = 20;
static constexpr int MAXIMUM_LABEL_WIDTH = 42;
2021-11-20 19:08:35 +00:00
static constexpr int MAXIMUM_LABEL_HEIGHT = 20;
static constexpr int MAXIMUM_HEIGHT = PinBodyWidget::HEIGHT + PinWidget::PIN_LABEL_SPACING
+ PinWidget::LABEL_HEIGHT;
Position position = Position::TOP;
QString pinNameLabelText;
2021-04-04 21:04:12 +01:00
PinWidget(
const Targets::TargetPinDescriptor& pinDescriptor,
const Targets::TargetVariant& targetVariant,
InsightWorker& insightWorker,
QWidget* parent
);
2021-04-04 21:04:12 +01:00
2021-06-21 00:14:31 +01:00
void updatePinState(const Targets::TargetPinState& pinState) override {
2021-04-04 21:04:12 +01:00
TargetPinWidget::updatePinState(pinState);
if (this->bodyWidget != nullptr) {
this->bodyWidget->setPinState(pinState);
}
}
private:
QVBoxLayout* layout = nullptr;
QLabel* pinNumberLabel = nullptr;
PinBodyWidget* bodyWidget = nullptr;
2021-04-04 21:04:12 +01:00
};
}