]> sigrok.org Git - pulseview.git/blame - pv/view/rowitem.h
Added RowItemOwner
[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
29class View;
30
31class RowItem : public SelectableItem
32{
33public:
34 /**
35 * Constructor.
36 */
37 RowItem();
38
39 /**
40 * Returns true if the item is visible and enabled.
41 */
42 virtual bool enabled() const = 0;
43
44 /**
45 * Gets the vertical layout offset of this signal.
46 */
1ef49ddd 47 int v_offset() const;
23935421
JH
48
49 /**
50 * Sets the vertical layout offset of this signal.
51 */
52 void set_v_offset(int v_offset);
53
54 /**
55 * Sets the view that owns this trace in the view trace hierachy.
56 * @param The new owner of the trace.
57 */
58 void set_view(pv::view::View *view);
59
60 /**
61 * Gets the y-offset of the axis.
62 */
63 int get_y() const;
64
65 /**
66 * Paints the background layer of the trace with a QPainter
67 * @param p the QPainter to paint into.
68 * @param left the x-coordinate of the left edge of the signal
69 * @param right the x-coordinate of the right edge of the signal
70 **/
71 virtual void paint_back(QPainter &p, int left, int right);
72
73 /**
74 * Paints the mid-layer of the trace with a QPainter
75 * @param p the QPainter to paint into.
76 * @param left the x-coordinate of the left edge of the signal
77 * @param right the x-coordinate of the right edge of the signal
78 **/
79 virtual void paint_mid(QPainter &p, int left, int right);
80
81 /**
82 * Paints the foreground layer of the trace with a QPainter
83 * @param p the QPainter to paint into.
84 * @param left the x-coordinate of the left edge of the signal
85 * @param right the x-coordinate of the right edge of the signal
86 **/
87 virtual void paint_fore(QPainter &p, int left, int right);
88
89 /**
90 * Paints the signal label.
91 * @param p the QPainter to paint into.
92 * @param right the x-coordinate of the right edge of the header
93 * area.
94 * @param hover true if the label is being hovered over by the mouse.
95 */
96 virtual void paint_label(QPainter &p, int right, bool hover) = 0;
97
98 /**
99 * Computes the outline rectangle of a label.
100 * @param right the x-coordinate of the right edge of the header
101 * area.
102 * @return Returns the rectangle of the signal label.
103 */
104 virtual QRectF label_rect(int right) = 0;
105
106public:
107 virtual void hover_point_changed();
108
109protected:
110 pv::view::View *_view;
111
112 int _v_offset;
113};
114
115} // namespace view
116} // namespace pv
117
118#endif // PULSEVIEW_PV_VIEW_HEADERITEM_H