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
21 #ifndef PULSEVIEW_PV_VIEW_HEADERITEM_H
22 #define PULSEVIEW_PV_VIEW_HEADERITEM_H
26 #include <QPropertyAnimation>
28 #include "rowitempaintparams.hpp"
29 #include "selectableitem.hpp"
36 class RowItem : public SelectableItem,
37 public std::enable_shared_from_this<pv::view::RowItem>
40 Q_PROPERTY(int visual_v_offset
42 WRITE set_visual_v_offset)
51 * Gets the vertical layout offset of this signal.
53 int layout_v_offset() const;
56 * Sets the vertical layout offset of this signal.
58 void set_layout_v_offset(int v_offset);
61 * Gets the vertical visual offset of this signal.
63 int visual_v_offset() const;
66 * Sets the vertical visual offset of this signal.
68 void set_visual_v_offset(int v_offset);
71 * Sets the visual and layout offset of this signal.
73 void force_to_v_offset(int v_offset);
76 * Begins an animation that will animate the visual offset toward
79 void animate_to_layout_v_offset();
82 * Gets the owner this trace in the view trace hierachy.
84 pv::view::RowItemOwner* owner() const;
87 * Sets the owner this trace in the view trace hierachy.
88 * @param The new owner of the trace.
90 void set_owner(pv::view::RowItemOwner *owner);
93 * Gets the visual y-offset of the axis.
95 int get_visual_y() const;
98 * Gets the drag point of the row item.
100 QPoint point() const;
103 * Computes the vertical extents of the contents of this row item.
104 * @return A pair containing the minimum and maximum y-values.
106 virtual std::pair<int, int> v_extents() const = 0;
109 * Paints the background layer of the trace with a QPainter
110 * @param p the QPainter to paint into.
111 * @param pp the painting parameters object to paint with.
113 virtual void paint_back(QPainter &p, const RowItemPaintParams &pp);
116 * Paints the mid-layer of the trace with a QPainter
117 * @param p the QPainter to paint into.
118 * @param pp the painting parameters object to paint with.
120 virtual void paint_mid(QPainter &p, const RowItemPaintParams &pp);
123 * Paints the foreground layer of the trace with a QPainter
124 * @param p the QPainter to paint into.
125 * @param pp the painting parameters object to paint with.
127 virtual void paint_fore(QPainter &p, const RowItemPaintParams &pp);
130 * Paints the signal label.
131 * @param p the QPainter to paint into.
132 * @param rect the rectangle of the header area.
133 * @param hover true if the label is being hovered over by the mouse.
135 virtual void paint_label(QPainter &p, const QRect &rect, bool hover) = 0;
138 virtual void hover_point_changed();
141 pv::view::RowItemOwner *owner_;
143 int layout_v_offset_;
144 int visual_v_offset_;
147 QPropertyAnimation v_offset_animation_;
153 #endif // PULSEVIEW_PV_VIEW_HEADERITEM_H