--- /dev/null
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "selectableitem.h"
+
+namespace pv {
+namespace view {
+
+SelectableItem::SelectableItem() :
+ _selected(false)
+{
+}
+
+bool SelectableItem::selected() const
+{
+ return _selected;
+}
+
+void SelectableItem::select(bool select)
+{
+ _selected = select;
+}
+
+} // namespace view
+} // namespace pv
Signal::Signal(const sr_probe *const probe) :
_probe(probe),
_name(probe->name),
- _v_offset(0),
- _selected(false)
+ _v_offset(0)
{
assert(_probe);
}
_v_offset = v_offset;
}
-bool Signal::selected() const
-{
- return _selected;
-}
-
-void Signal::select(bool select)
-{
- _selected = select;
-}
-
void Signal::paint_label(QPainter &p, int y, int right, bool hover)
{
p.setBrush(_colour);
QPointF(label_rect.left() + 1, label_rect.bottom() - 1)
};
- if (_selected) {
+ if (selected()) {
p.setPen(QPen(QApplication::palette().brush(
QPalette::Highlight), LabelHighlightRadius,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
*/
void set_v_offset(int v_offset);
- /**
- * Returns true if the signal has been selected by the user.
- */
- bool selected() const;
-
- /**
- * Selects or deselects the signal.
- */
- void select(bool select = true);
-
/**
* Paints the signal with a QPainter
* @param p the QPainter to paint into.
QColor _colour;
int _v_offset;
- bool _selected;
-
QSizeF _text_size;
};