#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<RowItem> >& RowItemOwner::child_items()
+{
+ return _items;
+}
+
const vector< shared_ptr<RowItem> >& RowItemOwner::child_items() const
{
return _items;
_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<int, int> RowItemOwner::v_extents() const
+{
+ pair<int, int> extents(0, 0);
+ for (const shared_ptr<RowItem> r : child_items()) {
+ assert(r);
+ if (!r->enabled())
+ continue;
+
+ const int child_offset = r->layout_v_offset();
+ const pair<int, int> 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