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"
33 class TraceTreeItemOwner;
35 class TraceTreeItem : public RowItem,
36 public std::enable_shared_from_this<TraceTreeItem>
39 Q_PROPERTY(int visual_v_offset
41 WRITE set_visual_v_offset)
50 * Gets the owner of this item in the view item hierachy.
52 TraceTreeItemOwner* owner() const;
55 * Selects or deselects the signal.
57 void select(bool select = true);
60 * Gets the vertical layout offset of this signal.
62 int layout_v_offset() const;
65 * Sets the vertical layout offset of this signal.
67 void set_layout_v_offset(int v_offset);
70 * Gets the vertical visual offset of this signal.
72 int visual_v_offset() const;
75 * Sets the vertical visual offset of this signal.
77 void set_visual_v_offset(int v_offset);
80 * Sets the visual and layout offset of this signal.
82 void force_to_v_offset(int v_offset);
85 * Begins an animation that will animate the visual offset toward
88 void animate_to_layout_v_offset();
91 * Sets the owner this trace in the view trace hierachy.
92 * @param The new owner of the trace.
94 void set_owner(TraceTreeItemOwner *owner);
97 * Gets the visual y-offset of the axis.
99 int get_visual_y() const;
102 * Drags the item to a delta relative to the drag point.
103 * @param delta the offset from the drag point.
105 void drag_by(const QPoint &delta);
108 * Gets the arrow-tip point of the row item marker.
109 * @param rect the rectangle of the header area.
111 QPoint point(const QRect &rect) const;
114 * Sets the new background colour state: false = dark, true = bright.
115 * This is to allow for alternating backgrounds but has no effect
116 * when coloured background colours are used.
117 * @param state New bg color state to use.
119 void set_bgcolour_state(bool state);
122 * Computes the vertical extents of the contents of this row item.
123 * @return A pair containing the minimum and maximum y-values.
125 virtual std::pair<int, int> v_extents() const = 0;
128 TraceTreeItemOwner *owner_;
130 int layout_v_offset_;
131 int visual_v_offset_;
133 bool bgcolour_state_;
136 QPropertyAnimation v_offset_animation_;
139 } // namespace TraceView
143 #endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEM_HPP