]>
Commit | Line | Data |
---|---|---|
51ae69ae TS |
1 | /* |
2 | * This file is part of the PulseView project. | |
3 | * | |
4 | * Copyright (C) 2014 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/>. |
51ae69ae TS |
18 | */ |
19 | ||
f4e57597 SA |
20 | #ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRIGGER_MARKER_HPP |
21 | #define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRIGGER_MARKER_HPP | |
51ae69ae TS |
22 | |
23 | #include "timeitem.hpp" | |
24 | ||
119c5c23 SA |
25 | #include <QPoint> |
26 | ||
51ae69ae | 27 | namespace pv { |
f4e57597 | 28 | namespace views { |
1573bf16 | 29 | namespace trace { |
51ae69ae | 30 | |
1373fec5 SA |
31 | /** |
32 | * The TriggerMarker class is used to show to the user at what point in time | |
33 | * a trigger occured. It is not editable by the user. | |
34 | */ | |
51ae69ae TS |
35 | class TriggerMarker : public TimeItem |
36 | { | |
37 | Q_OBJECT | |
38 | ||
39 | public: | |
641574bc | 40 | static const QColor Color; |
51ae69ae TS |
41 | |
42 | public: | |
43 | /** | |
44 | * Constructor. | |
45 | * @param view A reference to the view that owns this marker. | |
46 | * @param time The time to set the marker to. | |
47 | */ | |
48 | TriggerMarker(View &view, const pv::util::Timestamp& time); | |
49 | ||
50 | /** | |
51 | * Copy constructor. | |
52 | */ | |
53 | TriggerMarker(const TriggerMarker &marker); | |
54 | ||
55 | /** | |
56 | * Returns true if the item is visible and enabled. | |
57 | */ | |
58 | bool enabled() const override; | |
59 | ||
60 | /** | |
61 | Returns true if the item may be dragged/moved. | |
62 | */ | |
119c5c23 | 63 | bool is_draggable(QPoint pos) const override; |
51ae69ae TS |
64 | |
65 | /** | |
66 | * Sets the time of the marker. | |
67 | */ | |
68 | void set_time(const pv::util::Timestamp& time) override; | |
69 | ||
70 | float get_x() const override; | |
71 | ||
72 | /** | |
73 | * Gets the arrow-tip point of the time marker. | |
74 | * @param rect the rectangle of the ruler area. | |
75 | */ | |
a3d5a7c7 | 76 | QPoint drag_point(const QRect &rect) const override; |
51ae69ae TS |
77 | |
78 | /** | |
79 | * Paints the foreground layer of the item with a QPainter | |
80 | * @param p the QPainter to paint into. | |
81 | * @param pp the painting parameters object to paint with. | |
223d0c37 | 82 | */ |
60938e04 | 83 | void paint_fore(QPainter &p, ViewItemPaintParams &pp) override; |
51ae69ae TS |
84 | |
85 | private: | |
86 | pv::util::Timestamp time_; | |
87 | }; | |
88 | ||
1573bf16 | 89 | } // namespace trace |
f4e57597 | 90 | } // namespace views |
51ae69ae TS |
91 | } // namespace pv |
92 | ||
f4e57597 | 93 | #endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRIGGER_MARKER_HPP |