]> sigrok.org Git - pulseview.git/blob - pv/view/header.h
5474f10eb48bcac2461f8d58546605e86d409173
[pulseview.git] / pv / view / header.h
1 /*
2  * This file is part of the PulseView project.
3  *
4  * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19  */
20
21 #ifndef PULSEVIEW_PV_VIEW_HEADER_H
22 #define PULSEVIEW_PV_VIEW_HEADER_H
23
24 #include <boost/shared_ptr.hpp>
25 #include <boost/weak_ptr.hpp>
26
27 #include <list>
28 #include <utility>
29
30 #include "marginwidget.h"
31
32 namespace pv {
33 namespace view {
34
35 class Trace;
36 class View;
37
38 class Header : public MarginWidget
39 {
40         Q_OBJECT
41
42 private:
43         static const int Padding;
44
45 public:
46         Header(View &parent);
47
48         QSize sizeHint() const;
49
50 private:
51         boost::shared_ptr<pv::view::Trace> get_mouse_over_trace(
52                 const QPoint &pt);
53
54         void clear_selection();
55
56 private:
57         void paintEvent(QPaintEvent *event);
58
59 private:
60         void mousePressEvent(QMouseEvent * event);
61
62         void mouseReleaseEvent(QMouseEvent *event);
63
64         void mouseMoveEvent(QMouseEvent *event);
65
66         void leaveEvent(QEvent *event);
67
68         void contextMenuEvent(QContextMenuEvent *event);
69
70         void keyPressEvent(QKeyEvent *e);
71
72 private slots:
73         void on_signals_changed();
74
75         void on_signals_moved();
76
77         void on_trace_text_changed();
78
79 signals:
80         void signals_moved();
81
82 private:
83         QPoint _mouse_point;
84         QPoint _mouse_down_point;
85         bool _dragging;
86
87         std::list<std::pair<boost::weak_ptr<Trace>, int> >
88                 _drag_traces;
89 };
90
91 } // namespace view
92 } // namespace pv
93
94 #endif // PULSEVIEW_PV_VIEW_HEADER_H