]> sigrok.org Git - pulseview.git/blame - pv/view/signal.hpp
ScaleSignalHandle: Initial implementation
[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
f1626bb8 31#include "signalscalehandle.hpp"
2acdb232 32#include "trace.hpp"
4b5782e1 33#include "viewitemowner.hpp"
e0e90d80 34
e8d00928
ML
35namespace sigrok {
36 class Channel;
37}
8d3e0764 38
51e77110
JH
39namespace pv {
40
2b81ae46 41class Session;
b86aa8f4 42
1b1ec774 43namespace data {
28a4c9c5 44class SignalData;
1b1ec774 45}
28a4c9c5 46
a2f71ef0
JH
47namespace view {
48
4b5782e1 49class Signal : public Trace, public ViewItemOwner
28a4c9c5 50{
2a2512b2
JH
51 Q_OBJECT
52
28a4c9c5 53protected:
2b81ae46 54 Signal(pv::Session &session,
b86aa8f4 55 std::shared_ptr<sigrok::Channel> channel);
28a4c9c5
JH
56
57public:
49f8ff3f
JH
58 /**
59 * Sets the name of the signal.
60 */
61 void set_name(QString name);
62
f9abf97e 63 virtual std::shared_ptr<pv::data::SignalData> data() const = 0;
9a0cd293 64
b3b57abc 65 /**
931f20b0 66 * Returns true if the trace is visible and enabled.
a29bb7fb 67 */
931f20b0 68 bool enabled() const;
a29bb7fb 69
aca00b1e
JH
70 void enable(bool enable = true);
71
e8d00928 72 std::shared_ptr<sigrok::Channel> channel() const;
632ba77e 73
4b5782e1
JH
74 /**
75 * Returns a list of row items owned by this object.
76 */
77 const item_list& child_items() const;
78
0c0218fd
JH
79 virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
80
86e823ca
JH
81 QMenu* create_context_menu(QWidget *parent);
82
5ed1adf5
JH
83 void delete_pressed();
84
214470fc
JH
85 /**
86 * Returns the offset to show the drag handle.
87 */
88 virtual int scale_handle_offset() const = 0;
89
90 /**
91 * Handles the scale handle being dragged to an offset.
92 * @param offset the offset the scale handle was dragged to.
93 */
94 virtual void scale_handle_dragged(int offset) = 0;
95
96 /**
97 * Handles the scale handle being being released.
98 */
99 virtual void scale_handle_released() {};
100
e9213170 101private Q_SLOTS:
86e823ca
JH
102 void on_disable();
103
28a4c9c5 104protected:
2b81ae46 105 pv::Session &session_;
8dbbc7f0 106 std::shared_ptr<sigrok::Channel> channel_;
cec48d16 107
f1626bb8 108 const std::shared_ptr<SignalScaleHandle> scale_handle_;
4b5782e1
JH
109 const item_list items_;
110
8dbbc7f0
JH
111 QComboBox *name_widget_;
112 bool updating_name_widget_;
28a4c9c5 113};
51e77110 114
8d634081 115} // namespace view
51e77110 116} // namespace pv
640d091b 117
7a01bd36 118#endif // PULSEVIEW_PV_VIEW_SIGNAL_HPP