Re: Model/view ideas for GtkListBox/GtkFlowBox

To get some idea what we are talking about here, I've started by writing a toy implementation of a list that reuses rows. You can find it here:

The example binary can scroll a 50.000 row list with labels or entries without noticeable problems.

Lessons learned so far:
- Average row heights are a little tricky. If you scroll into a region where your rows happen to be 2 lines instead of one, your list jumps to twice the size. I ended up using a very slow-changing average to counteract this.
- Scrolling with average heights needs to be done carefully. Otherwise, you'll never reach 'the far end'. I ended up doing size allocation from the end that we're closer to. I was afraid that this would make the 'jump in the middle', but it seems to work mostly ok.

There's of course a lot of stuff missing here:
- no keynav
- no sorting
- no headers
- no caching beyond the visible range
- no pixelcache (do we need it ?)
- no attempt to keep a stable row-item relation while an item is visible. I just always reconnect all rows

But I found this exercise pretty enlightening.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]