+ return vector< shared_ptr<ViewItem> >(view_.begin(), view_.end());
+}
+
+shared_ptr<ViewItem> Header::get_mouse_over_item(const QPoint &pt)
+{
+ const QRect r(0, 0, width() - BaselineOffset, height());
+ for (auto &i : view_)
+ if (i->enabled() && i->label_rect(r).contains(pt))
+ return i;
+ return shared_ptr<RowItem>();
+}
+
+void Header::clear_selection()
+{
+ for (auto &i : view_)
+ i->select(false);
+ update();
+}
+
+void Header::paintEvent(QPaintEvent*)
+{
+ // The trace labels are not drawn with the arrows exactly on the
+ // left edge of the widget, because then the selection shadow
+ // would be clipped away.
+ const QRect rect(0, 0, width() - BaselineOffset, height());
+
+ vector< shared_ptr<RowItem> > row_items(
+ view_.begin(), view_.end());
+
+ stable_sort(row_items.begin(), row_items.end(),
+ [](const shared_ptr<RowItem> &a, const shared_ptr<RowItem> &b) {
+ return a->visual_v_offset() < b->visual_v_offset(); });