Intention of `getRowPosition(rowNum, false)`

I’ve been working a lot with ListBox lately and have come across something that has confused me. While reading the source for ListBox::getRowPosition(), I got a little confused at the intention behind the relativeToComponentTopLeft parameter. Here’s the source for reference:

Rectangle<int> ListBox::getRowPosition (int rowNumber, bool relativeToComponentTopLeft) const noexcept
{
    auto y = viewport->getY() + rowHeight * rowNumber;

    if (relativeToComponentTopLeft)
        y -= viewport->getViewPositionY();

    return { viewport->getX(), y,
             viewport->getViewedComponent()->getWidth(), rowHeight };
}

Obviously, when relativeToComponentTopLeft is true, the value you get is the position of the row relative to the top-left of the ListBox component itself. However, what confuses me is the value returned if you set that argument to false. Because the returned value still incorporates viewport->getY(), you’re getting the y-coordinate of the row relative to the top of the Viewport’s scrollable child component, plus the y-coordinate of the Viewport itself relative to the ListBox?

I’m just trying to understand what use this value could be so that I can better understand the design of the class as a whole. As far as I see it, the only values you’d want are:

  1. The value returned when relativeToComponentTopLeft is true, i.e. row position relative to ListBox
  2. The position of the row relative to the top of the viewport child, i.e. rowHeight * rowNumber

I just can’t puzzle out why you’d want the second value added to viewport->getY(). Thanks in advance for any guidance!

Blind guess here: couldn’t that be of any use with TableListBox which can have a header?

Ah, I hadn’t considered that. Not familiar enough with TableListBox to say for sure, but that would make sense. As I said, I just want to make sure I’m not misusing these methods.

It’d sure be nice if this parameter was documented! As it stands, I don’t feel the parameter name is clear enough.