SmartTableArrivals.h

The new rows a table still owes an entrance to, and what counts as having seen one.

Source/SmartTables/Public/SmartTableArrivals.h

The rows a table counts as new, keyed by the model's own row id. An entry outlives the entrance it was filed for, and Expire is what takes it away.

The entrance is tied to being SEEN and never to the widget being built. A list that virtualises builds a row as soon as any part of it crosses the view, which for a row being scrolled toward is a thin edge at the bottom. An entrance started there is over before the row is really on screen.

By id, never by row number: every index below a dropped row names a different row afterwards. The id source is the model, so a table calls Reset on a swap. The window and the shown fraction are passed per call and never held here.

Struct
FSmartTableArrivals
Members
13

Public functions 10

Apply
void Apply( const FSmartTableRowSetDiff & Diff, double Now )

Marks the rows a model says arrived, as of Now, and drops the marks of the rows it says left.

A replaced set drops every mark first. Its rows did not arrive one by one, and a row id from the set before can name a different row now.

Mark
void Mark( FName RowId, double Now )

This row is new, as of Now. Marking a row that is already marked arms it again, which is what a feed re-adding a row it just dropped is asking for.

Unmark
void Unmark( FName RowId )

A row on its way out is owed no entrance. Without this the mark sits out the whole window, and the default row id is the row number, so the row moving up into that number finds it waiting.

IsEmpty
bool IsEmpty() const

Nothing is new. Tested before any of the per-frame work, so a table with no arrivals never walks its rows looking for one.

IsNew
bool IsNew( FName RowId ) const

This row counts as new.

Still true once the entrance has played, because the question is whether the row is new and not whether it still owes an animation. Anything branching on this needs the same answer for every cell of the row, on the first build and on every one after it.

OwesEntrance
bool OwesEntrance( FName RowId ) const

This row is new AND its entrance has not played. The narrower of the two questions, and the one that decides whether a wrapper hides itself.

MarkPlayed
void MarkPlayed( FName RowId, bool bPlayed )

Writes down whether the entrance really played.

Takes the answer instead of standing in for one. A wrapper the list reused without a new row set on it was never armed, and it turns the play down without a word. Marked played all the same, the row stops counting as owed and its entrance never runs.

Expire
void Expire( double Now, float WindowSeconds )

Drops every row marked longer ago than WindowSeconds.

The clock runs from the mark and never from the moment the row was seen. A row nothing looked at in time loses its entrance, and one that played keeps its entry until that same window is out. A wrapper still holding itself invisible for a dropped entry is freed by the caller's own sweep.

Reset
void Reset()

Every mark dropped, for a new model. One assignment, so a field added to this type is reset along with all the rest.

IsRevealedstatic
static bool IsRevealed( float RowTop, float RowHeight, float ListTop, float ListBottom, float Fraction )

Enough of the row is on screen to count as seen.

Everything is in absolute space, the same space a cached geometry reports. A row of no height has not been seen: the list built it, and nothing has laid it out yet.

Fraction is how much of the row height has to fall inside the list. Anything near zero counts the thin edge of a row that has only just crossed the bottom.

Private variables 1

Rows
TMap< FName, FSmartTableRowArrival > Rows

FSmartTableRowArrival struct

One row the table counts as new, seen or not.

Public variables 2

ArrivedAt
double ArrivedAt = 0.0

When Mark was called, and never written again after. Slate time and not the world one: widget animations run on the Slate delta, which no time scale touches and no pause stops.

bPlayed
bool bPlayed = false

A row plays its entrance once. Set once it has played, and kept until the entry runs out of time, so a row cannot be seen, scrolled off and seen again into a second entrance.

Next: SmartTableOpenMenu.h