2 * This file is part of the PulseView project.
4 * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
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.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP
21 #define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP
23 #include "tracetreeitem.hpp"
24 #include "tracetreeitemowner.hpp"
30 class TraceGroup : public TraceTreeItem, public TraceTreeItemOwner
35 static const int Padding;
36 static const int Width;
37 static const int LineThickness;
38 static const QColor LineColour;
44 virtual ~TraceGroup();
47 * Returns true if the item is visible and enabled.
52 * Returns the session of the onwer.
54 pv::Session& session();
57 * Returns the session of the onwer.
59 const pv::Session& session() const;
62 * Returns the view of the owner.
67 * Returns the view of the owner.
69 virtual const View* view() const;
72 * Computes the vertical extents of the contents of this row item.
73 * @return A pair containing the minimum and maximum y-values.
75 std::pair<int, int> v_extents() const;
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
82 * @param hover true if the label is being hovered over by the mouse.
84 void paint_label(QPainter &p, const QRect &rect, bool hover);
87 * Computes the outline rectangle of a label.
88 * @param rect the rectangle of the header area.
89 * @return Returns the rectangle of the signal label.
91 QRectF label_rect(const QRectF &rect) const;
94 * Determines if a point is in the header label rect.
95 * @param left the x-coordinate of the left edge of the header
97 * @param right the x-coordinate of the right edge of the header
99 * @param point the point to test.
101 bool pt_in_label_rect(int left, int right, const QPoint &point);
103 QMenu* create_context_menu(QWidget *parent);
105 pv::widgets::Popup* create_popup(QWidget *parent);
108 * Returns the total vertical offset of this trace and all it's owners
110 int owner_visual_v_offset() const;
112 void restack_items();
115 * Returns the number of nested parents that this row item owner has.
117 unsigned int depth() const;
122 void row_item_appearance_changed(bool label, bool content);
124 void extents_changed(bool horz, bool vert);
130 } // namespace TraceView
134 #endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP