]> sigrok.org Git - pulseview.git/blame - pv/view/flag.hpp
Cursor: Don't draw cursors over each other when they have equal time
[pulseview.git] / pv / view / flag.hpp
CommitLineData
8914fe79
JH
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, 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_FLAG_H
22#define PULSEVIEW_PV_VIEW_FLAG_H
23
dbfae3f1
JH
24#include <memory>
25
8914fe79
JH
26#include "timemarker.hpp"
27
28namespace pv {
29namespace view {
30
dbfae3f1
JH
31class Flag : public TimeMarker,
32 public std::enable_shared_from_this<pv::view::Flag>
8914fe79
JH
33{
34 Q_OBJECT
35
36public:
37 static const QColor FillColour;
38
39public:
40 /**
41 * Constructor.
42 * @param view A reference to the view that owns this cursor pair.
43 * @param time The time to set the flag to.
44 * @param text The text of the marker.
45 */
46 Flag(View &view, double time, const QString &text);
47
48 /**
49 * Copy constructor.
50 */
51 Flag(const Flag &flag);
52
53 /**
54 * Returns true if the item is visible and enabled.
55 */
56 bool enabled() const;
57
58 /**
59 * Gets the text to show in the marker.
60 */
61 QString get_text() const;
62
63 pv::widgets::Popup* create_popup(QWidget *parent);
64
dbfae3f1
JH
65 void delete_pressed();
66
8914fe79
JH
67private Q_SLOTS:
68 void on_text_changed(const QString &text);
69
70private:
71 QString text_;
72};
73
74} // namespace view
75} // namespace pv
76
77#endif // PULSEVIEW_PV_VIEW_FLAG_H