]> sigrok.org Git - pulseview.git/blame - pv/view/tracegroup.h
Header: Keep a shared_ptr of the clicked item
[pulseview.git] / pv / view / tracegroup.h
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
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_TRACEGROUP_H
22#define PULSEVIEW_PV_VIEW_TRACEGROUP_H
23
24#include "rowitem.h"
25#include "rowitemowner.h"
26
27namespace pv {
28namespace view {
29
30class TraceGroup : public RowItem, public RowItemOwner
31{
32 Q_OBJECT
33
b781f806
JH
34private:
35 static const int Padding;
36 static const int Width;
37
722930c1
JH
38public:
39 /**
40 * Virtual destructor
41 */
42 virtual ~TraceGroup();
43
44 /**
45 * Returns true if the item is visible and enabled.
46 */
47 bool enabled() const;
48
49 /**
50 * Returns the session of the onwer.
51 */
52 pv::SigSession& session();
53
54 /**
55 * Returns the session of the onwer.
56 */
57 const pv::SigSession& session() const;
58
59 /**
60 * Returns the view of the owner.
61 */
62 virtual pv::view::View* view();
63
64 /**
65 * Returns the view of the owner.
66 */
67 virtual const pv::view::View* view() const;
68
69 /**
70 * Paints the signal label.
71 * @param p the QPainter to paint into.
72 * @param right the x-coordinate of the right edge of the header
73 * area.
74 * @param hover true if the label is being hovered over by the mouse.
75 */
76 void paint_label(QPainter &p, int right, bool hover);
77
78 /**
79 * Computes the outline rectangle of a label.
80 * @param right the x-coordinate of the right edge of the header
81 * area.
82 * @return Returns the rectangle of the signal label.
83 */
0067d804 84 QRectF label_rect(int right) const;
722930c1
JH
85
86 /**
87 * Determines if a point is in the header label rect.
88 * @param left the x-coordinate of the left edge of the header
89 * area.
90 * @param right the x-coordinate of the right edge of the header
91 * area.
92 * @param point the point to test.
93 */
94 bool pt_in_label_rect(int left, int right, const QPoint &point);
95
96 QMenu* create_context_menu(QWidget *parent);
97
98 pv::widgets::Popup* create_popup(QWidget *parent);
99
100 /**
101 * Returns the total vertical offset of this trace and all it's owners
102 */
103 int owner_v_offset() const;
104
105 void update_viewport();
106};
107
108} // view
109} // pv
110
111#endif // PULSEVIEW_PV_VIEW_TRACEGROUP_H