]>
Commit | Line | Data |
---|---|---|
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 | ||
7a01bd36 JH |
21 | #ifndef PULSEVIEW_PV_VIEW_TRACEGROUP_HPP |
22 | #define PULSEVIEW_PV_VIEW_TRACEGROUP_HPP | |
722930c1 | 23 | |
af503b10 JH |
24 | #include "tracetreeitem.hpp" |
25 | #include "tracetreeitemowner.hpp" | |
722930c1 JH |
26 | |
27 | namespace pv { | |
28 | namespace view { | |
29 | ||
af503b10 | 30 | class TraceGroup : public TraceTreeItem, public TraceTreeItemOwner |
722930c1 JH |
31 | { |
32 | Q_OBJECT | |
33 | ||
b781f806 JH |
34 | private: |
35 | static const int Padding; | |
36 | static const int Width; | |
1dc835a4 JH |
37 | static const int LineThickness; |
38 | static const QColor LineColour; | |
b781f806 | 39 | |
722930c1 JH |
40 | public: |
41 | /** | |
42 | * Virtual destructor | |
43 | */ | |
44 | virtual ~TraceGroup(); | |
45 | ||
46 | /** | |
47 | * Returns true if the item is visible and enabled. | |
48 | */ | |
49 | bool enabled() const; | |
50 | ||
51 | /** | |
52 | * Returns the session of the onwer. | |
53 | */ | |
2b81ae46 | 54 | pv::Session& session(); |
722930c1 JH |
55 | |
56 | /** | |
57 | * Returns the session of the onwer. | |
58 | */ | |
2b81ae46 | 59 | const pv::Session& session() const; |
722930c1 JH |
60 | |
61 | /** | |
62 | * Returns the view of the owner. | |
63 | */ | |
64 | virtual pv::view::View* view(); | |
65 | ||
66 | /** | |
67 | * Returns the view of the owner. | |
68 | */ | |
69 | virtual const pv::view::View* view() const; | |
70 | ||
a5d93c27 JH |
71 | /** |
72 | * Computes the vertical extents of the contents of this row item. | |
73 | * @return A pair containing the minimum and maximum y-values. | |
74 | */ | |
75 | std::pair<int, int> v_extents() const; | |
76 | ||
722930c1 JH |
77 | /** |
78 | * Paints the signal label. | |
79 | * @param p the QPainter to paint into. | |
80 | * @param right the x-coordinate of the right edge of the header | |
81 | * area. | |
82 | * @param hover true if the label is being hovered over by the mouse. | |
83 | */ | |
b3f44329 | 84 | void paint_label(QPainter &p, const QRect &rect, bool hover); |
722930c1 JH |
85 | |
86 | /** | |
87 | * Computes the outline rectangle of a label. | |
b3f44329 | 88 | * @param rect the rectangle of the header area. |
722930c1 JH |
89 | * @return Returns the rectangle of the signal label. |
90 | */ | |
b3f44329 | 91 | QRectF label_rect(const QRectF &rect) const; |
722930c1 JH |
92 | |
93 | /** | |
94 | * Determines if a point is in the header label rect. | |
95 | * @param left the x-coordinate of the left edge of the header | |
96 | * area. | |
97 | * @param right the x-coordinate of the right edge of the header | |
98 | * area. | |
99 | * @param point the point to test. | |
100 | */ | |
101 | bool pt_in_label_rect(int left, int right, const QPoint &point); | |
102 | ||
103 | QMenu* create_context_menu(QWidget *parent); | |
104 | ||
105 | pv::widgets::Popup* create_popup(QWidget *parent); | |
106 | ||
107 | /** | |
108 | * Returns the total vertical offset of this trace and all it's owners | |
109 | */ | |
7ff0145f JH |
110 | int owner_visual_v_offset() const; |
111 | ||
112 | void restack_items(); | |
722930c1 | 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 | 121 | public: |
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 | |
126 | private Q_SLOTS: | |
127 | void on_ungroup(); | |
722930c1 JH |
128 | }; |
129 | ||
130 | } // view | |
131 | } // pv | |
132 | ||
7a01bd36 | 133 | #endif // PULSEVIEW_PV_VIEW_TRACEGROUP_HPP |