]>
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 | ||
dc747705 JH |
24 | #include <memory> |
25 | ||
7ff0145f JH |
26 | #include <QPropertyAnimation> |
27 | ||
26e3af6b | 28 | #include "viewitem.hpp" |
23935421 JH |
29 | |
30 | namespace pv { | |
31 | namespace view { | |
32 | ||
eae6e30a | 33 | class RowItemOwner; |
23935421 | 34 | |
26e3af6b | 35 | class RowItem : public ViewItem, |
dc747705 | 36 | public std::enable_shared_from_this<pv::view::RowItem> |
23935421 | 37 | { |
6dcdb325 | 38 | Q_OBJECT |
7ff0145f JH |
39 | Q_PROPERTY(int visual_v_offset |
40 | READ visual_v_offset | |
41 | WRITE set_visual_v_offset) | |
6dcdb325 | 42 | |
23935421 JH |
43 | public: |
44 | /** | |
45 | * Constructor. | |
46 | */ | |
47 | RowItem(); | |
48 | ||
23935421 JH |
49 | /** |
50 | * Gets the vertical layout offset of this signal. | |
51 | */ | |
be9e7b4b | 52 | int layout_v_offset() const; |
23935421 JH |
53 | |
54 | /** | |
55 | * Sets the vertical layout offset of this signal. | |
56 | */ | |
be9e7b4b JH |
57 | void set_layout_v_offset(int v_offset); |
58 | ||
59 | /** | |
60 | * Gets the vertical visual offset of this signal. | |
61 | */ | |
62 | int visual_v_offset() const; | |
63 | ||
64 | /** | |
65 | * Sets the vertical visual offset of this signal. | |
66 | */ | |
67 | void set_visual_v_offset(int v_offset); | |
68 | ||
69 | /** | |
70 | * Sets the visual and layout offset of this signal. | |
71 | */ | |
72 | void force_to_v_offset(int v_offset); | |
23935421 | 73 | |
7ff0145f JH |
74 | /** |
75 | * Begins an animation that will animate the visual offset toward | |
76 | * the layout offset. | |
77 | */ | |
78 | void animate_to_layout_v_offset(); | |
79 | ||
bd9a1f17 JH |
80 | /** |
81 | * Gets the owner this trace in the view trace hierachy. | |
82 | */ | |
83 | pv::view::RowItemOwner* owner() const; | |
84 | ||
23935421 | 85 | /** |
eae6e30a | 86 | * Sets the owner this trace in the view trace hierachy. |
23935421 JH |
87 | * @param The new owner of the trace. |
88 | */ | |
eae6e30a | 89 | void set_owner(pv::view::RowItemOwner *owner); |
23935421 JH |
90 | |
91 | /** | |
be9e7b4b | 92 | * Gets the visual y-offset of the axis. |
23935421 | 93 | */ |
be9e7b4b | 94 | int get_visual_y() const; |
23935421 | 95 | |
23e75650 JH |
96 | /** |
97 | * Drags the item to a delta relative to the drag point. | |
98 | * @param delta the offset from the drag point. | |
99 | */ | |
100 | void drag_by(const QPoint &delta); | |
101 | ||
0dda6fe5 | 102 | /** |
be717066 JH |
103 | * Gets the arrow-tip point of the row item marker. |
104 | * @param rect the rectangle of the header area. | |
0dda6fe5 | 105 | */ |
be717066 | 106 | QPoint point(const QRect &rect) const; |
0dda6fe5 | 107 | |
a5d93c27 JH |
108 | /** |
109 | * Computes the vertical extents of the contents of this row item. | |
110 | * @return A pair containing the minimum and maximum y-values. | |
111 | */ | |
112 | virtual std::pair<int, int> v_extents() const = 0; | |
113 | ||
23935421 JH |
114 | public: |
115 | virtual void hover_point_changed(); | |
116 | ||
117 | protected: | |
8dbbc7f0 | 118 | pv::view::RowItemOwner *owner_; |
23935421 | 119 | |
8dbbc7f0 JH |
120 | int layout_v_offset_; |
121 | int visual_v_offset_; | |
7ff0145f JH |
122 | |
123 | private: | |
8dbbc7f0 | 124 | QPropertyAnimation v_offset_animation_; |
23935421 JH |
125 | }; |
126 | ||
127 | } // namespace view | |
128 | } // namespace pv | |
129 | ||
130 | #endif // PULSEVIEW_PV_VIEW_HEADERITEM_H |