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