]> sigrok.org Git - pulseview.git/blame - pv/view/rowitem.h
Header: Moved drag functionality into SelectableItem
[pulseview.git] / pv / view / rowitem.h
CommitLineData
23935421
JH
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
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.
10 *
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.
15 *
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
19 */
20
21#ifndef PULSEVIEW_PV_VIEW_HEADERITEM_H
22#define PULSEVIEW_PV_VIEW_HEADERITEM_H
23
24#include "selectableitem.h"
25
26namespace pv {
27namespace view {
28
eae6e30a 29class RowItemOwner;
23935421
JH
30
31class RowItem : public SelectableItem
32{
6dcdb325
JH
33 Q_OBJECT
34
23935421
JH
35public:
36 /**
37 * Constructor.
38 */
39 RowItem();
40
41 /**
42 * Returns true if the item is visible and enabled.
43 */
44 virtual bool enabled() const = 0;
45
46 /**
47 * Gets the vertical layout offset of this signal.
48 */
1ef49ddd 49 int v_offset() const;
23935421
JH
50
51 /**
52 * Sets the vertical layout offset of this signal.
53 */
54 void set_v_offset(int v_offset);
55
bd9a1f17
JH
56 /**
57 * Gets the owner this trace in the view trace hierachy.
58 */
59 pv::view::RowItemOwner* owner() const;
60
23935421 61 /**
eae6e30a 62 * Sets the owner this trace in the view trace hierachy.
23935421
JH
63 * @param The new owner of the trace.
64 */
eae6e30a 65 void set_owner(pv::view::RowItemOwner *owner);
23935421
JH
66
67 /**
68 * Gets the y-offset of the axis.
69 */
70 int get_y() const;
71
0dda6fe5
JH
72 /**
73 * Gets the drag point of the row item.
74 */
75 QPoint point() const;
76
23935421
JH
77 /**
78 * Paints the background layer of the trace with a QPainter
79 * @param p the QPainter to paint into.
80 * @param left the x-coordinate of the left edge of the signal
81 * @param right the x-coordinate of the right edge of the signal
82 **/
83 virtual void paint_back(QPainter &p, int left, int right);
84
85 /**
86 * Paints the mid-layer of the trace with a QPainter
87 * @param p the QPainter to paint into.
88 * @param left the x-coordinate of the left edge of the signal
89 * @param right the x-coordinate of the right edge of the signal
90 **/
91 virtual void paint_mid(QPainter &p, int left, int right);
92
93 /**
94 * Paints the foreground layer of the trace with a QPainter
95 * @param p the QPainter to paint into.
96 * @param left the x-coordinate of the left edge of the signal
97 * @param right the x-coordinate of the right edge of the signal
98 **/
99 virtual void paint_fore(QPainter &p, int left, int right);
100
101 /**
102 * Paints the signal label.
103 * @param p the QPainter to paint into.
104 * @param right the x-coordinate of the right edge of the header
105 * area.
106 * @param hover true if the label is being hovered over by the mouse.
107 */
108 virtual void paint_label(QPainter &p, int right, bool hover) = 0;
109
110 /**
111 * Computes the outline rectangle of a label.
112 * @param right the x-coordinate of the right edge of the header
113 * area.
114 * @return Returns the rectangle of the signal label.
115 */
0067d804 116 virtual QRectF label_rect(int right) const = 0;
23935421
JH
117
118public:
119 virtual void hover_point_changed();
120
6dcdb325
JH
121Q_SIGNALS:
122 void appearance_changed();
123
23935421 124protected:
eae6e30a 125 pv::view::RowItemOwner *_owner;
23935421
JH
126
127 int _v_offset;
128};
129
130} // namespace view
131} // namespace pv
132
133#endif // PULSEVIEW_PV_VIEW_HEADERITEM_H