#include <extdef.h>
+#include <QApplication>
+
#include "signal.h"
#include "view.h"
namespace view {
const int Signal::LabelHitPadding = 2;
+const int Signal::LabelHighlightRadius = 6;
Signal::Signal(QString name) :
- _name(name)
+ _name(name),
+ _v_offset(0),
+ _selected(false)
{
}
_colour = colour;
}
+int Signal::get_v_offset() const
+{
+ return _v_offset;
+}
+
+void Signal::set_v_offset(int v_offset)
+{
+ _v_offset = v_offset;
+}
+
+bool Signal::selected() const
+{
+ return _selected;
+}
+
+void Signal::select(bool select)
+{
+ _selected = select;
+}
+
void Signal::paint_label(QPainter &p, const QRect &rect, bool hover)
{
p.setBrush(_colour);
QPointF(label_rect.left() + 1, label_rect.bottom() - 1)
};
+ if(_selected) {
+ p.setPen(QPen(QApplication::palette().brush(
+ QPalette::Highlight), LabelHighlightRadius,
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+ p.setBrush(Qt::transparent);
+ p.drawPolygon(points, countof(points));
+ }
+
p.setPen(Qt::transparent);
p.setBrush(hover ? colour.lighter() : colour);
p.drawPolygon(points, countof(points));