X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Frowitemowner.cpp;h=0fa230ab4e3fb47a609c105cb1de0dc91ad4d277;hb=a5d93c27b5bd6b95000e29c6cddac56ab254b289;hp=d6150f89a90e5db497bf6f2eae4e5a09e7b69e80;hpb=68b21a71797051fb48ed272bc2a6b4893bdbf517;p=pulseview.git diff --git a/pv/view/rowitemowner.cpp b/pv/view/rowitemowner.cpp index d6150f8..0fa230a 100644 --- a/pv/view/rowitemowner.cpp +++ b/pv/view/rowitemowner.cpp @@ -23,12 +23,21 @@ #include "rowitem.h" #include "rowitemowner.h" +using std::max; +using std::make_pair; +using std::min; +using std::pair; using std::shared_ptr; using std::vector; namespace pv { namespace view { +vector< shared_ptr >& RowItemOwner::child_items() +{ + return _items; +} + const vector< shared_ptr >& RowItemOwner::child_items() const { return _items; @@ -59,5 +68,44 @@ void RowItemOwner::remove_child_item(std::shared_ptr item) _items.erase(iter); } +RowItemOwner::iterator RowItemOwner::begin() +{ + return iterator(this, _items.begin()); +} + +RowItemOwner::iterator RowItemOwner::end() +{ + return iterator(this); +} + +RowItemOwner::const_iterator RowItemOwner::begin() const +{ + return const_iterator(this, _items.cbegin()); +} + +RowItemOwner::const_iterator RowItemOwner::end() const +{ + return const_iterator(this); +} + +pair RowItemOwner::v_extents() const +{ + pair extents(0, 0); + for (const shared_ptr r : child_items()) { + assert(r); + if (!r->enabled()) + continue; + + const int child_offset = r->v_offset(); + const pair child_extents = r->v_extents(); + extents.first = min(child_extents.first + child_offset, + extents.first); + extents.second = max(child_extents.second + child_offset, + extents.second); + } + + return extents; +} + } // view } // pv