/*
- * This file is part of the sigrok project.
+ * This file is part of the PulseView project.
*
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
*
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef PV_VIEW_HEADER_H
-#define PV_VIEW_HEADER_H
+#ifndef PULSEVIEW_PV_VIEW_HEADER_H
+#define PULSEVIEW_PV_VIEW_HEADER_H
-#include <QWidget>
+#include <list>
+#include <memory>
+#include <utility>
+
+#include "marginwidget.h"
namespace pv {
namespace view {
+class Trace;
class View;
-class Header : public QWidget
+class Header : public MarginWidget
{
Q_OBJECT
+private:
+ static const int Padding;
+
public:
Header(View &parent);
+ QSize sizeHint() const;
+
+ /**
+ * The horizontal offset, relative to the left edge of the widget,
+ * where the arrows of the trace labels end.
+ */
+ static const int BaselineOffset;
+
+private:
+ std::shared_ptr<pv::view::Trace> get_mouse_over_trace(
+ const QPoint &pt);
+
+ void clear_selection();
+
private:
void paintEvent(QPaintEvent *event);
private:
- View &_view;
+ void mousePressEvent(QMouseEvent * event);
+
+ void mouseReleaseEvent(QMouseEvent *event);
+
+ void mouseMoveEvent(QMouseEvent *event);
+
+ void leaveEvent(QEvent *event);
+
+ void contextMenuEvent(QContextMenuEvent *event);
+
+ void keyPressEvent(QKeyEvent *e);
+
+private Q_SLOTS:
+ void on_signals_changed();
+
+ void on_signals_moved();
+
+ void on_trace_changed();
+
+Q_SIGNALS:
+ void signals_moved();
+
+private:
+ QPoint _mouse_point;
+ QPoint _mouse_down_point;
+ bool _dragging;
+
+ std::list<std::pair<std::weak_ptr<Trace>, int> >
+ _drag_traces;
};
} // namespace view
} // namespace pv
-#endif // PV_VIEW_HEADER_H
+#endif // PULSEVIEW_PV_VIEW_HEADER_H