]> sigrok.org Git - pulseview.git/blobdiff - pv/signal.h
Added a label colour chooser dialog
[pulseview.git] / pv / signal.h
index b4c4244ca3fc438f7a71441bfc0a7de80fec0674..2afe9528dfe8cceac605d38c6600977f7381b61c 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#ifndef PULSEVIEW_PV_SIGNAL_H
+#define PULSEVIEW_PV_SIGNAL_H
+
 #include <boost/shared_ptr.hpp>
 
+#include <QColor>
 #include <QPainter>
 #include <QRect>
 #include <QString>
@@ -33,15 +37,32 @@ class SignalData;
 class Signal
 {
 private:
-       static const QSizeF LabelPadding;
        static const int LabelHitPadding;
 
 protected:
        Signal(QString name);
 
 public:
+       /**
+        * Gets the name of this signal.
+        */
        QString get_name() const;
 
+       /**
+        * Sets the name of the signal.
+        */
+       void set_name(QString name);
+
+       /**
+        * Get the colour of the signal.
+        */
+       QColor get_colour() const;
+
+       /**
+        * Set the colour of the signal.
+        */
+       void set_colour(QColor colour);
+
        /**
         * Paints the signal with a QPainter
         * @param p the QPainter to paint into.
@@ -86,11 +107,6 @@ private:
        QRectF get_label_rect(const QRect &rect);
 
 protected:
-       /**
-        * Get the colour of the logic signal
-        */
-       virtual QColor get_colour() const = 0;
-
        /**
         * When painting into the rectangle, calculate the y
         * offset of the zero point.
@@ -99,7 +115,11 @@ protected:
 
 protected:
        QString _name;
+       QColor _colour;
+
        QSizeF _text_size;
 };
 
 } // namespace pv
+
+#endif // PULSEVIEW_PV_SIGNAL_H