]> sigrok.org Git - pulseview.git/blob - pv/view/signalscalehandle.hpp
Minor whitespace and Doxygen fixes.
[pulseview.git] / pv / view / signalscalehandle.hpp
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
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_SIGNALSCALEHANDLE_HPP
22 #define PULSEVIEW_PV_VIEW_SIGNALSCALEHANDLE_HPP
23
24 #include "rowitem.hpp"
25
26 namespace pv {
27 namespace view {
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.
83          */
84         void paint_fore(QPainter &p, const ViewItemPaintParams &pp);
85
86 private:
87         Signal &owner_;
88 };
89
90 } // namespace view
91 } // namespace pv
92
93 #endif // PULSEVIEW_PV_VIEW_SIGNALSCALEHANDLE_HPP