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, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "tracegroup.h"
28 using std::shared_ptr;
33 const int TraceGroup::Padding = 8;
34 const int TraceGroup::Width = 12;
36 TraceGroup::~TraceGroup()
42 bool TraceGroup::enabled() const
44 return std::any_of(child_items().begin(), child_items().end(),
45 [](const shared_ptr<RowItem> &r) { return r->enabled(); });
48 pv::SigSession& TraceGroup::session()
51 return _owner->session();
54 const pv::SigSession& TraceGroup::session() const
57 return _owner->session();
60 pv::view::View* TraceGroup::view()
63 return _owner->view();
66 const pv::view::View* TraceGroup::view() const
69 return _owner->view();
72 pair<int, int> TraceGroup::v_extents() const
74 return RowItemOwner::v_extents();
77 void TraceGroup::paint_label(QPainter &p, int right, bool hover)
84 QRectF TraceGroup::label_rect(int right) const
87 for (const shared_ptr<RowItem> r : child_items())
89 rect = rect.united(r->label_rect(right));
91 return QRectF(rect.x() - Width - Padding, rect.y(),
92 Width, rect.height());
95 bool TraceGroup::pt_in_label_rect(int left, int right, const QPoint &point)
104 QMenu* TraceGroup::create_context_menu(QWidget *parent)
111 pv::widgets::Popup* TraceGroup::create_popup(QWidget *parent)
117 int TraceGroup::owner_v_offset() const
119 return v_offset() + _owner->owner_v_offset();
122 void TraceGroup::update_viewport()
125 _owner->update_viewport();