]>
Commit | Line | Data |
---|---|---|
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 |
26 | using std::pair; |
27 | using std::shared_ptr; | |
28 | using std::vector; | |
29 | ||
18f7104f JH |
30 | namespace pv { |
31 | ||
2b81ae46 | 32 | class Session; |
18f7104f | 33 | |
f4e57597 SA |
34 | namespace views { |
35 | namespace TraceView { | |
18f7104f | 36 | |
af503b10 | 37 | class TraceTreeItem; |
18f7104f JH |
38 | class View; |
39 | ||
c373f828 | 40 | class TraceTreeItemOwner : public ViewItemOwner |
18f7104f | 41 | { |
6b715302 | 42 | public: |
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 | */ | |
6f925ba9 | 78 | vector< shared_ptr<TraceTreeItem> > |
c373f828 JH |
79 | trace_tree_child_items() const; |
80 | ||
68b21a71 JH |
81 | /** |
82 | * Clears the list of child items. | |
83 | */ | |
84 | void clear_child_items(); | |
85 | ||
86 | /** | |
87 | * Adds a child item to this object. | |
88 | */ | |
6f925ba9 | 89 | void add_child_item(shared_ptr<TraceTreeItem> item); |
68b21a71 JH |
90 | |
91 | /** | |
92 | * Removes a child item from this object. | |
93 | */ | |
6f925ba9 | 94 | void remove_child_item(shared_ptr<TraceTreeItem> item); |
18f7104f | 95 | |
c373f828 | 96 | virtual void restack_items(); |
6046c19d | 97 | |
a5d93c27 JH |
98 | /** |
99 | * Computes the vertical extents of the contents of this row item owner. | |
100 | * @return A pair containing the minimum and maximum y-values. | |
101 | */ | |
6f925ba9 | 102 | pair<int, int> v_extents() const; |
a5d93c27 | 103 | |
ac0708fb SA |
104 | /* |
105 | * Reassigns background color states to all its children, thereby | |
106 | * providing them with alternating backgrounds. | |
5d738861 | 107 | * @param next_bgcolour_state First brightness state to use. |
ac0708fb SA |
108 | * @return The next brightness state to use. |
109 | */ | |
110 | bool reassign_bgcolour_states(bool next_bgcolour_state); | |
111 | ||
32218d3e | 112 | public: |
6e2c3c85 | 113 | virtual void row_item_appearance_changed(bool label, bool content) = 0; |
32218d3e JH |
114 | |
115 | virtual void extents_changed(bool horz, bool vert) = 0; | |
18f7104f JH |
116 | }; |
117 | ||
f4e57597 SA |
118 | } // namespace TraceView |
119 | } // namespace views | |
120 | } // namespace pv | |
18f7104f | 121 | |
f4e57597 | 122 | #endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEMOWNER_HPP |