2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
2021-10-23 12:45:01 +01:00
|
|
|
#include <cstdint>
|
2021-10-06 21:12:31 +01:00
|
|
|
#include <QVBoxLayout>
|
2021-10-23 12:45:01 +01:00
|
|
|
#include <QPainter>
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-05-03 20:00:52 +01:00
|
|
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
|
|
|
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPinWidget.hpp"
|
2021-10-06 21:12:31 +01:00
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
#include "PinBodyWidget.hpp"
|
|
|
|
|
#include "src/Targets/TargetVariant.hpp"
|
|
|
|
|
|
2021-07-07 20:54:45 +01:00
|
|
|
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
|
2021-10-23 12:45:01 +01:00
|
|
|
{
|
|
|
|
|
TOP,
|
|
|
|
|
BOTTOM
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
class PinWidget: public TargetPinWidget
|
|
|
|
|
{
|
2021-10-06 21:12:31 +01:00
|
|
|
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;
|
2022-04-30 02:38:38 +01:00
|
|
|
static constexpr int PIN_NAME_LABEL_LONG_LINE_LENGTH = 25;
|
|
|
|
|
static constexpr int PIN_NAME_LABEL_SHORT_LINE_LENGTH = 5;
|
|
|
|
|
static constexpr int PIN_DIRECTION_LABEL_LONG_LINE_LENGTH = 22;
|
|
|
|
|
static constexpr int PIN_DIRECTION_LABEL_SHORT_LINE_LENGTH = 21;
|
2021-11-20 19:08:35 +00:00
|
|
|
static constexpr int LABEL_HEIGHT = 20;
|
2021-12-30 18:08:53 +00:00
|
|
|
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
|
|
|
|
2021-05-24 20:58:49 +01:00
|
|
|
PinWidget(
|
|
|
|
|
const Targets::TargetPinDescriptor& pinDescriptor,
|
2021-09-04 18:03:45 +01:00
|
|
|
const Targets::TargetVariant& targetVariant,
|
|
|
|
|
QWidget* parent
|
2021-05-24 20:58:49 +01:00
|
|
|
);
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-06 21:12:31 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QVBoxLayout* layout = nullptr;
|
2022-05-03 20:00:52 +01:00
|
|
|
Label* pinNumberLabel = nullptr;
|
2021-10-06 21:12:31 +01:00
|
|
|
PinBodyWidget* bodyWidget = nullptr;
|
2021-04-04 21:04:12 +01:00
|
|
|
};
|
|
|
|
|
}
|