PulseView  0.3.0
A Qt-based sigrok GUI
tracetreeitem.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of the PulseView project.
3  *
4  * Copyright (C) 2013 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_TRACETREEITEM_HPP
22 #define PULSEVIEW_PV_VIEW_TRACETREEITEM_HPP
23 
24 #include <memory>
25 
26 #include <QPropertyAnimation>
27 
28 #include "rowitem.hpp"
29 
30 namespace pv {
31 namespace view {
32 
33 class TraceTreeItemOwner;
34 
35 class TraceTreeItem : public RowItem,
36  public std::enable_shared_from_this<pv::view::TraceTreeItem>
37 {
38  Q_OBJECT
39  Q_PROPERTY(int visual_v_offset
40  READ visual_v_offset
42 
43 public:
47  TraceTreeItem();
48 
52  TraceTreeItemOwner* owner() const;
53 
57  void select(bool select = true);
58 
62  int layout_v_offset() const;
63 
67  void set_layout_v_offset(int v_offset);
68 
72  int visual_v_offset() const;
73 
77  void set_visual_v_offset(int v_offset);
78 
82  void force_to_v_offset(int v_offset);
83 
89 
95 
99  int get_visual_y() const;
100 
105  void drag_by(const QPoint &delta);
106 
111  QPoint point(const QRect &rect) const;
112 
119  void set_bgcolour_state(bool state);
120 
125  virtual std::pair<int, int> v_extents() const = 0;
126 
127 protected:
129 
132 
134 
135 private:
136  QPropertyAnimation v_offset_animation_;
137 };
138 
139 } // namespace view
140 } // namespace pv
141 
142 #endif // PULSEVIEW_PV_VIEW_TRACETREEITEM_HPP
QPoint point(const QRect &rect) const
virtual std::pair< int, int > v_extents() const =0
int layout_v_offset() const
void select(bool select=true)
void set_layout_v_offset(int v_offset)
int visual_v_offset() const
void set_visual_v_offset(int v_offset)
TraceTreeItemOwner * owner() const
void set_bgcolour_state(bool state)
void drag_by(const QPoint &delta)
void force_to_v_offset(int v_offset)
void set_owner(pv::view::TraceTreeItemOwner *owner)
TraceTreeItemOwner * owner_
QPropertyAnimation v_offset_animation_