X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Frowitemowner.cpp;h=03f0e68d3ae52e5a0451f80c66683052b470e460;hb=be9e7b4bb29b6594ec2b64442748ab135b684bf8;hp=d6150f89a90e5db497bf6f2eae4e5a09e7b69e80;hpb=68b21a71797051fb48ed272bc2a6b4893bdbf517;p=pulseview.git diff --git a/pv/view/rowitemowner.cpp b/pv/view/rowitemowner.cpp index d6150f8..03f0e68 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->layout_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