SmartTableResizeGesture.h

One column resize, from the press or the button that starts it to whatever ends it.

Source/SmartTables/Public/SmartTableResizeGesture.h

One column resize going on, from whatever starts it to whatever ends it.

Two TYPES and never one struct with a flag: a pointer drag and an intent hold write different fields. A field only the pointer drag measures is a field only the pointer shape carries, so no reader can take a column named with no press behind it for a drag.

Reset writes a whole fresh value. A field added to any shape above clears itself, with no list of clears for it to be left out of.

Not a USTRUCT, since nothing here is authored, saved or reached from Blueprint.

Struct
FSmartTableResizeGesture
Members
15

Public functions 7

IsActive
bool IsActive() const

True between the start of a resize and whatever ends it, whichever way it came in.

IsFromIntent
bool IsFromIntent() const

Begun by an intent and not by a pointer. EndColumnResize is what ends one, and no release can.

AsPointer
const FSmartTablePointerResize * AsPointer() const

The press behind a pointer drag, or null for either other shape. An intent measured no press and has nothing here to give back.

GetColumnId
FName GetColumnId() const

The column being resized, whichever way in, or none while nothing is.

IsDrivenBy
bool IsDrivenBy( int32 ByUser, uint32 ByPointer ) const

Whether a pointer drag begun by this exact "user" and pointer is going on.

Both halves, and never just "is a pointer dragging". A release from a second "user" must not end a drag it never began, and on a table driven by both a cursor and a virtual pointer that is a real case.

IsAtRest
bool IsAtRest() const

No gesture going on, and no snapshot left over from one.

Both halves, since either can be true on its own: the SHeaderRow sizing grip fills StartWidths and starts no gesture at all. A field added above belongs in this test as well as in Reset.

Reset
void Reset()

Back to rest, in one write. A whole fresh value and never field by field, so a field added above needs no clear of its own here.

Public variables 2

Kind
TVariant< FSmartTableNoResize, FSmartTablePointerResize, FSmartTableIntentResize > Kind

Which of the three shapes this is. Callers write it to start a gesture, and the tests below are what reads it back.

StartWidths
TMap< FName, float > StartWidths

The width of every shown column as this gesture first found it.

A drag is measured against this snapshot, never against the widths in force this frame. A neighbour moves exactly as far as the drag moved, and a drag out and back lands where it started.

Keyed by name and never by number. Hide a column part way through a hold and a number would point at its neighbour. It sits outside the three shapes, and it has to: the SHeaderRow sizing grip settles a width without ever saying a gesture began, and this fills up while nothing is resizing.

FSmartTablePointerResize struct

A pointer is dragging a column edge.

HandleHeaderRowMouseDown builds every one of these, and it is the one place a press is measured. Every field below is written there, so a gesture in this shape can be read for all of them with no test for whether anything ever wrote them.

Public variables 5

ColumnId
FName ColumnId

The column being dragged.

A name, and never an index into the shown order. Columns can be hidden or reordered part way through a drag, and the name is the only handle that lives through it.

PressLocalX
float PressLocalX = 0.0f

Where the press went down, in the header's own local space, which is the space the widths are in.

StartWidth
float StartWidth = 0.0f

The width of the dragged column as the press went down. Every move of the drag is measured from this, and never from the width the frame before settled at.

UserIndex
int32 UserIndex = INDEX_NONE

The Slate "user" whose press began this, and which pointer on it.

The capture was taken for exactly this pair and is owed back to it. A real cursor is only one Slate "user" a table can be driven by, and a world-space screen builds its pointer on a virtual one. So CursorUserIndex is a guess, not an answer.

PointerIndexpure virtual
uint32 PointerIndex = 0

FSmartTableIntentResize struct

A control is holding a column open: a pad button, a key, a UMG button wired to BeginColumnResize.

Nothing measured a press here, and the column is all there is to hold. Read as a pointer drag, this shape would aim its column at the raw cursor X off two fields nothing ever wrote.

Public variables 1

ColumnId
FName ColumnId

Next: SmartTableScrollMove.h