MathSignal: Add config dialog
[pulseview.git] / pv / views / trace / triggermarker.hpp
blob40c096c0292fa32778c078f0a26bb5fbb1059789
1 /*
2 * This file is part of the PulseView project.
4 * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
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.
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.
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/>.
20 #ifndef PULSEVIEW_PV_VIEWS_TRACE_TRIGGERMARKER_HPP
21 #define PULSEVIEW_PV_VIEWS_TRACE_TRIGGERMARKER_HPP
23 #include "timeitem.hpp"
25 #include <QPoint>
27 namespace pv {
28 namespace views {
29 namespace trace {
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.
35 class TriggerMarker : public TimeItem
37 Q_OBJECT
39 public:
40 static const QColor Color;
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.
48 TriggerMarker(View &view, const pv::util::Timestamp& time);
50 /**
51 * Copy constructor.
53 TriggerMarker(const TriggerMarker &marker);
55 /**
56 * Returns true if the item is visible and enabled.
58 bool enabled() const override;
60 /**
61 Returns true if the item may be dragged/moved.
63 bool is_draggable(QPoint pos) const override;
65 /**
66 * Sets the time of the marker.
68 void set_time(const pv::util::Timestamp& time) override;
70 virtual const pv::util::Timestamp time() const override;
72 float get_x() const override;
74 /**
75 * Gets the arrow-tip point of the time marker.
76 * @param rect the rectangle of the ruler area.
78 QPoint drag_point(const QRect &rect) const override;
80 /**
81 * Paints the foreground layer of the item with a QPainter
82 * @param p the QPainter to paint into.
83 * @param pp the painting parameters object to paint with.
85 void paint_fore(QPainter &p, ViewItemPaintParams &pp) override;
87 private:
88 pv::util::Timestamp time_;
91 } // namespace trace
92 } // namespace views
93 } // namespace pv
95 #endif // PULSEVIEW_PV_VIEWS_TRACE_TRIGGERMARKER_HPP