]> sigrok.org Git - pulseview.git/blob - pv/view/header.hpp
DecodeTrace: Remove unneeded pointer to the signalbase instance
[pulseview.git] / pv / view / header.hpp
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_VIEWS_TRACEVIEW_HEADER_HPP
22 #define PULSEVIEW_PV_VIEWS_TRACEVIEW_HEADER_HPP
23
24 #include <list>
25 #include <memory>
26 #include <utility>
27
28 #include "marginwidget.hpp"
29
30 namespace pv {
31 namespace views {
32 namespace TraceView {
33
34 class TraceTreeItem;
35 class View;
36 class ViewItem;
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         /**
51          * The extended area that the header widget would like to be sized to.
52          * @remarks This area is the area specified by sizeHint, extended by
53          * the area to overlap the viewport.
54          */
55         QSize extended_size_hint() const;
56
57         /**
58          * The horizontal offset, relative to the left edge of the widget,
59          * where the arrows of the trace labels end.
60          */
61         static const int BaselineOffset;
62
63 private:
64         /**
65          * Gets the row items.
66          */
67         std::vector< std::shared_ptr<ViewItem> > items();
68
69         /**
70          * Gets the first view item which has a label that contains @c pt .
71          * @param pt the point to search with.
72          * @return the view item that has been found, or and empty
73          *   @c shared_ptr if no item was found.
74          */
75         std::shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt);
76
77 private:
78         void paintEvent(QPaintEvent *event);
79
80 private:
81         void contextMenuEvent(QContextMenuEvent *event);
82
83         void keyPressEvent(QKeyEvent *event);
84
85 private Q_SLOTS:
86         void on_group();
87
88         void on_ungroup();
89 };
90
91 } // namespace TraceView
92 } // namespace views
93 } // namespace pv
94
95 #endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_HEADER_HPP