]>
Commit | Line | Data |
---|---|---|
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 | ||
26 | namespace pv { | |
27 | namespace view { | |
28 | ||
eae6e30a | 29 | class RowItemOwner; |
23935421 JH |
30 | |
31 | class RowItem : public SelectableItem | |
32 | { | |
6dcdb325 JH |
33 | Q_OBJECT |
34 | ||
23935421 JH |
35 | public: |
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 | ||
72 | /** | |
73 | * Paints the background layer of the trace with a QPainter | |
74 | * @param p the QPainter to paint into. | |
75 | * @param left the x-coordinate of the left edge of the signal | |
76 | * @param right the x-coordinate of the right edge of the signal | |
77 | **/ | |
78 | virtual void paint_back(QPainter &p, int left, int right); | |
79 | ||
80 | /** | |
81 | * Paints the mid-layer of the trace with a QPainter | |
82 | * @param p the QPainter to paint into. | |
83 | * @param left the x-coordinate of the left edge of the signal | |
84 | * @param right the x-coordinate of the right edge of the signal | |
85 | **/ | |
86 | virtual void paint_mid(QPainter &p, int left, int right); | |
87 | ||
88 | /** | |
89 | * Paints the foreground layer of the trace with a QPainter | |
90 | * @param p the QPainter to paint into. | |
91 | * @param left the x-coordinate of the left edge of the signal | |
92 | * @param right the x-coordinate of the right edge of the signal | |
93 | **/ | |
94 | virtual void paint_fore(QPainter &p, int left, int right); | |
95 | ||
96 | /** | |
97 | * Paints the signal label. | |
98 | * @param p the QPainter to paint into. | |
99 | * @param right the x-coordinate of the right edge of the header | |
100 | * area. | |
101 | * @param hover true if the label is being hovered over by the mouse. | |
102 | */ | |
103 | virtual void paint_label(QPainter &p, int right, bool hover) = 0; | |
104 | ||
105 | /** | |
106 | * Computes the outline rectangle of a label. | |
107 | * @param right the x-coordinate of the right edge of the header | |
108 | * area. | |
109 | * @return Returns the rectangle of the signal label. | |
110 | */ | |
0067d804 | 111 | virtual QRectF label_rect(int right) const = 0; |
23935421 JH |
112 | |
113 | public: | |
114 | virtual void hover_point_changed(); | |
115 | ||
6dcdb325 JH |
116 | Q_SIGNALS: |
117 | void appearance_changed(); | |
118 | ||
23935421 | 119 | protected: |
eae6e30a | 120 | pv::view::RowItemOwner *_owner; |
23935421 JH |
121 | |
122 | int _v_offset; | |
123 | }; | |
124 | ||
125 | } // namespace view | |
126 | } // namespace pv | |
127 | ||
128 | #endif // PULSEVIEW_PV_VIEW_HEADERITEM_H |