1 // Copyright (c) 2016 The SigViewer Development Team 2 // Licensed under the GNU General Public License (GPL) 3 // https://www.gnu.org/licenses/gpl 4 5 6 #ifndef LABEL_WIDGET_H 7 #define LABEL_WIDGET_H 8 9 #include "base/sigviewer_user_types.h" 10 #include "gui/signal_view_settings.h" 11 12 #include <QMap> 13 #include <QWidget> 14 #include <QSharedPointer> 15 16 namespace sigviewer 17 { 18 19 //----------------------------------------------------------------------------- 20 class LabelWidget : public QWidget 21 { 22 Q_OBJECT 23 public: 24 LabelWidget (QSharedPointer<SignalViewSettings const> signal_view_settings); 25 26 void addChannel(ChannelID channel_nr, const QString& label); 27 void removeChannel(ChannelID channel_nr); 28 29 public slots: 30 void changeYStart (int32 y_start); 31 void enableSeparator(bool enable); 32 void changeLabelColor(QColor labelColor); 33 34 protected: 35 void paintEvent(QPaintEvent* pe); 36 virtual void contextMenuEvent (QContextMenuEvent* event); 37 38 private: 39 QSharedPointer<SignalViewSettings const> signal_view_settings_; 40 41 QMap<ChannelID, QString> channel_nr2label_; 42 int32 y_start_; 43 bool enable_separator_; 44 QColor label_color_; 45 }; 46 47 } 48 49 #endif 50