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_TRACETREEITEM_HPP
21 #define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEM_HPP
25 #include <QPropertyAnimation>
27 #include "rowitem.hpp"
29 using std::enable_shared_from_this;
36 class TraceTreeItemOwner;
38 class TraceTreeItem : public RowItem,
39 public enable_shared_from_this<TraceTreeItem>
42 Q_PROPERTY(int visual_v_offset
44 WRITE set_visual_v_offset)
53 * Gets the owner of this item in the view item hierachy.
55 TraceTreeItemOwner* owner() const;
58 * Selects or deselects the signal.
60 void select(bool select = true);
63 * Gets the vertical layout offset of this signal.
65 int layout_v_offset() const;
68 * Sets the vertical layout offset of this signal.
70 void set_layout_v_offset(int v_offset);
73 * Gets the vertical visual offset of this signal.
75 int visual_v_offset() const;
78 * Sets the vertical visual offset of this signal.
80 void set_visual_v_offset(int v_offset);
83 * Sets the visual and layout offset of this signal.
85 void force_to_v_offset(int v_offset);
88 * Begins an animation that will animate the visual offset toward
91 void animate_to_layout_v_offset();
94 * Sets the owner this trace in the view trace hierachy.
95 * @param The new owner of the trace.
97 void set_owner(TraceTreeItemOwner *owner);
100 * Gets the visual y-offset of the axis.
102 int get_visual_y() const;
105 * Drags the item to a delta relative to the drag point.
106 * @param delta the offset from the drag point.
108 void drag_by(const QPoint &delta);
111 * Gets the arrow-tip point of the row item marker.
112 * @param rect the rectangle of the header area.
114 QPoint drag_point(const QRect &rect) const;
117 * Computes the vertical extents of the contents of this row item.
118 * @return A pair containing the minimum and maximum y-values.
120 virtual pair<int, int> v_extents() const = 0;
123 TraceTreeItemOwner *owner_;
125 int layout_v_offset_;
126 int visual_v_offset_;
129 QPropertyAnimation v_offset_animation_;
136 #endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEM_HPP