]>
Commit | Line | Data |
---|---|---|
f1626bb8 JH |
1 | /* |
2 | * This file is part of the PulseView project. | |
3 | * | |
4 | * Copyright (C) 2015 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 | |
efdec55a | 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
f1626bb8 JH |
18 | */ |
19 | ||
f4e57597 SA |
20 | #ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNALSCALEHANDLE_HPP |
21 | #define PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNALSCALEHANDLE_HPP | |
f1626bb8 JH |
22 | |
23 | #include "rowitem.hpp" | |
24 | ||
25 | namespace pv { | |
f4e57597 SA |
26 | namespace views { |
27 | namespace TraceView { | |
f1626bb8 JH |
28 | |
29 | class Signal; | |
30 | ||
31 | /** | |
32 | * A row item owned by a @c Signal that implements the v-scale adjustment grab | |
33 | * handle. | |
34 | */ | |
35 | class SignalScaleHandle : public RowItem | |
36 | { | |
37 | Q_OBJECT | |
38 | public: | |
39 | /** | |
40 | * Constructor | |
41 | */ | |
42 | explicit SignalScaleHandle(Signal &owner); | |
43 | ||
44 | public: | |
45 | /** | |
46 | * Returns true if the parent item is enabled. | |
47 | */ | |
48 | bool enabled() const; | |
49 | ||
50 | /** | |
51 | * Selects or deselects the signal. | |
52 | */ | |
53 | void select(bool select = true); | |
54 | ||
55 | /** | |
56 | * Sets this item into the un-dragged state. | |
57 | */ | |
58 | void drag_release(); | |
59 | ||
60 | /** | |
61 | * Drags the item to a delta relative to the drag point. | |
62 | * @param delta the offset from the drag point. | |
63 | */ | |
64 | void drag_by(const QPoint &delta); | |
65 | ||
66 | /** | |
67 | * Get the drag point. | |
68 | * @param rect the rectangle of the widget area. | |
69 | */ | |
70 | QPoint point(const QRect &rect) const; | |
71 | ||
72 | /** | |
73 | * Computes the outline rectangle of the viewport hit-box. | |
74 | * @param rect the rectangle of the viewport area. | |
75 | * @return Returns the rectangle of the hit-box. | |
76 | */ | |
77 | QRectF hit_box_rect(const ViewItemPaintParams &pp) const; | |
78 | ||
79 | /** | |
80 | * Paints the foreground layer of the item with a QPainter | |
81 | * @param p the QPainter to paint into. | |
82 | * @param pp the painting parameters object to paint with. | |
223d0c37 | 83 | */ |
60938e04 | 84 | void paint_fore(QPainter &p, ViewItemPaintParams &pp); |
f1626bb8 JH |
85 | |
86 | private: | |
87 | Signal &owner_; | |
88 | }; | |
89 | ||
f4e57597 SA |
90 | } // namespace TraceView |
91 | } // namespace views | |
f1626bb8 JH |
92 | } // namespace pv |
93 | ||
f4e57597 | 94 | #endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNALSCALEHANDLE_HPP |