]> sigrok.org Git - pulseview.git/blame - pv/views/trace/tracegroup.hpp
DecodeTrace: Add fallback icon for edit-paste action
[pulseview.git] / pv / views / trace / tracegroup.hpp
CommitLineData
722930c1
JH
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2013 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
efdec55a 17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
722930c1
JH
18 */
19
f4e57597
SA
20#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP
21#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP
722930c1 22
af503b10
JH
23#include "tracetreeitem.hpp"
24#include "tracetreeitemowner.hpp"
722930c1 25
6f925ba9
UH
26using std::pair;
27
722930c1 28namespace pv {
f4e57597 29namespace views {
1573bf16 30namespace trace {
722930c1 31
af503b10 32class TraceGroup : public TraceTreeItem, public TraceTreeItemOwner
722930c1
JH
33{
34 Q_OBJECT
35
b781f806
JH
36private:
37 static const int Padding;
38 static const int Width;
1dc835a4 39 static const int LineThickness;
641574bc 40 static const QColor LineColor;
b781f806 41
722930c1
JH
42public:
43 /**
44 * Virtual destructor
45 */
46 virtual ~TraceGroup();
47
48 /**
49 * Returns true if the item is visible and enabled.
50 */
51 bool enabled() const;
52
53 /**
54 * Returns the session of the onwer.
55 */
2b81ae46 56 pv::Session& session();
722930c1
JH
57
58 /**
59 * Returns the session of the onwer.
60 */
2b81ae46 61 const pv::Session& session() const;
722930c1
JH
62
63 /**
64 * Returns the view of the owner.
65 */
f4e57597 66 virtual View* view();
722930c1
JH
67
68 /**
69 * Returns the view of the owner.
70 */
f4e57597 71 virtual const View* view() const;
722930c1 72
a5d93c27
JH
73 /**
74 * Computes the vertical extents of the contents of this row item.
75 * @return A pair containing the minimum and maximum y-values.
76 */
6f925ba9 77 pair<int, int> v_extents() const;
a5d93c27 78
722930c1
JH
79 /**
80 * Paints the signal label.
81 * @param p the QPainter to paint into.
82 * @param right the x-coordinate of the right edge of the header
83 * area.
84 * @param hover true if the label is being hovered over by the mouse.
85 */
b3f44329 86 void paint_label(QPainter &p, const QRect &rect, bool hover);
722930c1
JH
87
88 /**
89 * Computes the outline rectangle of a label.
b3f44329 90 * @param rect the rectangle of the header area.
722930c1
JH
91 * @return Returns the rectangle of the signal label.
92 */
b3f44329 93 QRectF label_rect(const QRectF &rect) const;
722930c1
JH
94
95 /**
96 * Determines if a point is in the header label rect.
97 * @param left the x-coordinate of the left edge of the header
98 * area.
99 * @param right the x-coordinate of the right edge of the header
100 * area.
101 * @param point the point to test.
102 */
103 bool pt_in_label_rect(int left, int right, const QPoint &point);
104
9e773fec 105 QMenu* create_header_context_menu(QWidget *parent);
722930c1
JH
106
107 pv::widgets::Popup* create_popup(QWidget *parent);
108
109 /**
110 * Returns the total vertical offset of this trace and all it's owners
111 */
7ff0145f
JH
112 int owner_visual_v_offset() const;
113
3e769a37
JH
114 /**
115 * Returns the number of nested parents that this row item owner has.
116 */
117 unsigned int depth() const;
118
5d6b95f9
JH
119 void ungroup();
120
32218d3e 121public:
6e2c3c85 122 void row_item_appearance_changed(bool label, bool content);
32218d3e
JH
123
124 void extents_changed(bool horz, bool vert);
0a51d1c1
JH
125
126private Q_SLOTS:
127 void on_ungroup();
722930c1
JH
128};
129
1573bf16 130} // namespace trace
f4e57597
SA
131} // namespace views
132} // namespace pv
722930c1 133
f4e57597 134#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP