]> sigrok.org Git - pulseview.git/blame - pv/view/signal.hpp
TraceTreeItem: Update when selection state changes
[pulseview.git] / pv / view / signal.hpp
CommitLineData
28a4c9c5 1/*
b3f22de0 2 * This file is part of the PulseView project.
28a4c9c5
JH
3 *
4 * Copyright (C) 2012 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
7a01bd36
JH
21#ifndef PULSEVIEW_PV_VIEW_SIGNAL_HPP
22#define PULSEVIEW_PV_VIEW_SIGNAL_HPP
640d091b 23
f9abf97e 24#include <memory>
9a0cd293 25
9e40e83d 26#include <QComboBox>
9e40e83d 27#include <QWidgetAction>
e3f65ace 28
28a4c9c5
JH
29#include <stdint.h>
30
2acdb232 31#include "trace.hpp"
4b5782e1 32#include "viewitemowner.hpp"
e0e90d80 33
e8d00928
ML
34namespace sigrok {
35 class Channel;
36}
8d3e0764 37
51e77110
JH
38namespace pv {
39
2b81ae46 40class Session;
b86aa8f4 41
1b1ec774 42namespace data {
28a4c9c5 43class SignalData;
1b1ec774 44}
28a4c9c5 45
a2f71ef0
JH
46namespace view {
47
4b5782e1 48class Signal : public Trace, public ViewItemOwner
28a4c9c5 49{
2a2512b2
JH
50 Q_OBJECT
51
28a4c9c5 52protected:
2b81ae46 53 Signal(pv::Session &session,
b86aa8f4 54 std::shared_ptr<sigrok::Channel> channel);
28a4c9c5
JH
55
56public:
49f8ff3f
JH
57 /**
58 * Sets the name of the signal.
59 */
60 void set_name(QString name);
61
f9abf97e 62 virtual std::shared_ptr<pv::data::SignalData> data() const = 0;
9a0cd293 63
b3b57abc 64 /**
931f20b0 65 * Returns true if the trace is visible and enabled.
a29bb7fb 66 */
931f20b0 67 bool enabled() const;
a29bb7fb 68
aca00b1e
JH
69 void enable(bool enable = true);
70
e8d00928 71 std::shared_ptr<sigrok::Channel> channel() const;
632ba77e 72
4b5782e1
JH
73 /**
74 * Returns a list of row items owned by this object.
75 */
76 const item_list& child_items() const;
77
0c0218fd
JH
78 virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
79
86e823ca
JH
80 QMenu* create_context_menu(QWidget *parent);
81
5ed1adf5
JH
82 void delete_pressed();
83
e9213170 84private Q_SLOTS:
86e823ca
JH
85 void on_disable();
86
28a4c9c5 87protected:
2b81ae46 88 pv::Session &session_;
8dbbc7f0 89 std::shared_ptr<sigrok::Channel> channel_;
cec48d16 90
4b5782e1
JH
91 const item_list items_;
92
8dbbc7f0
JH
93 QComboBox *name_widget_;
94 bool updating_name_widget_;
28a4c9c5 95};
51e77110 96
8d634081 97} // namespace view
51e77110 98} // namespace pv
640d091b 99
7a01bd36 100#endif // PULSEVIEW_PV_VIEW_SIGNAL_HPP