]> sigrok.org Git - pulseview.git/blame - pv/views/trace/tracetreeitemowner.hpp
Annotation: Use special type for the class, not plain int
[pulseview.git] / pv / views / trace / tracetreeitemowner.hpp
CommitLineData
18f7104f
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
efdec55a 17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18f7104f
JH
18 */
19
f4e57597
SA
20#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEMOWNER_HPP
21#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEMOWNER_HPP
18f7104f 22
c373f828
JH
23#include "viewitemowner.hpp"
24#include "tracetreeitem.hpp"
6b715302 25
6f925ba9
UH
26using std::pair;
27using std::shared_ptr;
28using std::vector;
29
18f7104f
JH
30namespace pv {
31
2b81ae46 32class Session;
18f7104f 33
f4e57597 34namespace views {
1573bf16 35namespace trace {
18f7104f 36
af503b10 37class TraceTreeItem;
18f7104f
JH
38class View;
39
c373f828 40class TraceTreeItemOwner : public ViewItemOwner
18f7104f 41{
6b715302 42public:
18f7104f
JH
43 /**
44 * Returns the view of the owner.
45 */
f4e57597 46 virtual View* view() = 0;
18f7104f
JH
47
48 /**
49 * Returns the view of the owner.
50 */
f4e57597 51 virtual const View* view() const = 0;
18f7104f 52
7ff0145f 53 virtual int owner_visual_v_offset() const = 0;
18f7104f 54
c373f828 55 /**
f4e57597 56 * Returns the session of the owner.
c373f828 57 */
f4e57597 58 virtual Session& session() = 0;
c373f828
JH
59
60 /**
61 * Returns the session of the owner.
62 */
f4e57597 63 virtual const Session& session() const = 0;
c373f828 64
3e769a37
JH
65 /**
66 * Returns the number of nested parents that this row item owner has.
67 */
68 virtual unsigned int depth() const = 0;
69
6b715302
JH
70 /**
71 * Returns a list of row items owned by this object.
72 */
73 virtual const item_list& child_items() const;
68b21a71 74
c373f828
JH
75 /**
76 * Returns a list of row items owned by this object.
77 */
c063290a 78 vector< shared_ptr<TraceTreeItem> > trace_tree_child_items() const;
c373f828 79
68b21a71
JH
80 /**
81 * Clears the list of child items.
82 */
83 void clear_child_items();
84
85 /**
86 * Adds a child item to this object.
87 */
6f925ba9 88 void add_child_item(shared_ptr<TraceTreeItem> item);
68b21a71
JH
89
90 /**
91 * Removes a child item from this object.
92 */
6f925ba9 93 void remove_child_item(shared_ptr<TraceTreeItem> item);
18f7104f 94
c373f828 95 virtual void restack_items();
6046c19d 96
a5d93c27
JH
97 /**
98 * Computes the vertical extents of the contents of this row item owner.
99 * @return A pair containing the minimum and maximum y-values.
100 */
6f925ba9 101 pair<int, int> v_extents() const;
a5d93c27 102
32218d3e 103public:
6e2c3c85 104 virtual void row_item_appearance_changed(bool label, bool content) = 0;
32218d3e
JH
105
106 virtual void extents_changed(bool horz, bool vert) = 0;
18f7104f
JH
107};
108
1573bf16 109} // namespace trace
f4e57597
SA
110} // namespace views
111} // namespace pv
18f7104f 112
f4e57597 113#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEMOWNER_HPP