]> sigrok.org Git - pulseview.git/blobdiff - pv/view/tracetreeitemowner.hpp
Added ViewItemOwner
[pulseview.git] / pv / view / tracetreeitemowner.hpp
index b26b1e7e46d3e81846f96fb5b2682e19c48f857a..025c34edad69f6f421d9fc9264f60e46f81f7e7a 100644 (file)
 #ifndef PULSEVIEW_PV_VIEW_TRACETREEITEMOWNER_HPP
 #define PULSEVIEW_PV_VIEW_TRACETREEITEMOWNER_HPP
 
 #ifndef PULSEVIEW_PV_VIEW_TRACETREEITEMOWNER_HPP
 #define PULSEVIEW_PV_VIEW_TRACETREEITEMOWNER_HPP
 
-#include <memory>
-#include <vector>
-
-#include "rowitemiterator.hpp"
+#include "viewitemowner.hpp"
+#include "tracetreeitem.hpp"
 
 namespace pv {
 
 
 namespace pv {
 
@@ -35,24 +33,9 @@ namespace view {
 class TraceTreeItem;
 class View;
 
 class TraceTreeItem;
 class View;
 
-class TraceTreeItemOwner
+class TraceTreeItemOwner : public ViewItemOwner
 {
 public:
 {
 public:
-       typedef std::vector< std::shared_ptr<TraceTreeItem> > item_list;
-       typedef RowItemIterator<TraceTreeItemOwner, TraceTreeItem> iterator;
-       typedef RowItemIterator<const TraceTreeItemOwner, TraceTreeItem> const_iterator;
-
-public:
-       /**
-        * Returns the session of the onwer.
-        */
-       virtual pv::Session& session() = 0;
-
-       /**
-        * Returns the session of the owner.
-        */
-       virtual const pv::Session& session() const = 0;
-
        /**
         * Returns the view of the owner.
         */
        /**
         * Returns the view of the owner.
         */
@@ -65,6 +48,16 @@ public:
 
        virtual int owner_visual_v_offset() const = 0;
 
 
        virtual int owner_visual_v_offset() const = 0;
 
+       /**
+        * Returns the session of the onwer.
+        */
+       virtual pv::Session& session() = 0;
+
+       /**
+        * Returns the session of the owner.
+        */
+       virtual const pv::Session& session() const = 0;
+
        /**
         * Returns the number of nested parents that this row item owner has.
         */
        /**
         * Returns the number of nested parents that this row item owner has.
         */
@@ -80,6 +73,12 @@ public:
         */
        virtual const item_list& child_items() const;
 
         */
        virtual const item_list& child_items() const;
 
+       /**
+        * Returns a list of row items owned by this object.
+        */
+       std::vector< std::shared_ptr<TraceTreeItem> >
+       trace_tree_child_items() const;
+
        /**
         * Clears the list of child items.
         */
        /**
         * Clears the list of child items.
         */
@@ -95,43 +94,7 @@ public:
         */
        void remove_child_item(std::shared_ptr<TraceTreeItem> item);
 
         */
        void remove_child_item(std::shared_ptr<TraceTreeItem> item);
 
-       /**
-        * Returns a depth-first iterator at the beginning of the child TraceTreeItem
-        * tree.
-        */
-       iterator begin();
-
-       /**
-        * Returns a depth-first iterator at the end of the child TraceTreeItem tree.
-        */
-       iterator end();
-
-       /**
-        * Returns a constant depth-first iterator at the beginning of the
-        * child TraceTreeItem tree.
-        */
-       const_iterator begin() const;
-
-       /**
-        * Returns a constant depth-first iterator at the end of the child
-        * TraceTreeItem tree.
-        */
-       const_iterator end() const;
-
-       /**
-        * Creates a list of decendant signals filtered by type.
-        */
-       template<class T>
-       std::vector< std::shared_ptr<T> > list_by_type() {
-               std::vector< std::shared_ptr<T> > items;
-               for (const auto &r : *this) {
-                       std::shared_ptr<T> p = std::dynamic_pointer_cast<T>(r);
-                       if (p)
-                               items.push_back(p);
-               }
-
-               return items;
-       }
+       virtual void restack_items();
 
        /**
         * Computes the vertical extents of the contents of this row item owner.
 
        /**
         * Computes the vertical extents of the contents of this row item owner.
@@ -139,15 +102,10 @@ public:
         */
        std::pair<int, int> v_extents() const;
 
         */
        std::pair<int, int> v_extents() const;
 
-       virtual void restack_items();
-
 public:
        virtual void row_item_appearance_changed(bool label, bool content) = 0;
 
        virtual void extents_changed(bool horz, bool vert) = 0;
 public:
        virtual void row_item_appearance_changed(bool label, bool content) = 0;
 
        virtual void extents_changed(bool horz, bool vert) = 0;
-
-private:
-       item_list items_;
 };
 
 } // view
 };
 
 } // view