ATableView
- Module
- Arc
- Header
#include "Arc/Widgets/ATableView.h"- Namespace
Arcf
Type aliases
| Alias | Description |
|---|---|
using COnGenerateCell = std::function<TSharedPtr<AWidget>(int32_t , int32_t )> |
Properties
| Type | Name | Description |
|---|---|---|
static constexpr float | SCROLLBAR_GUTTER | Default 12.0f. |
static constexpr int32_t | OVERSCAN_ROWS | One row above and below the viewport: a scroll of less than a row must not have to generate a widget before it can paint. Default 1. |
ArcDelegate<void(const FTableCellRef&)> | OnSelectionChanged | |
ArcDelegate<void(const FTableCellRef&)> | OnCellActivated |
Public functions
| Returns | Name | Description |
|---|---|---|
ARC_WIDGET_ARGS | ||
void | SetColumns | |
const std::vector<FTableColumn>& | GetColumns | |
int32_t | GetColumnCount | |
void | SetRowCount | |
int32_t | GetRowCount | |
void | SetOnGenerateCell | |
void | SetFrozenColumns | Columns [0, count) never move under a horizontal scroll. |
int32_t | GetFrozenColumns | |
void | SetRowHeight | |
float | GetRowHeight | |
void | SetStripedRows | A plain list of records reads cleaner without the zebra a dense spreadsheet needs, and without a cursor frame while it is not the focused widget. |
void | SetCursorOnlyWhenFocused | |
const TSharedPtr<ATableHeader>& | GetHeader | |
void | RefreshCells | The rows changed identity under an unchanged shape — a sort, a filter, a re-source. |
void | ScrollTo | |
float | GetScrollX | |
float | GetScrollY | |
void | EnsureCellVisible | |
void | SetCursorCell | Moving the cursor with extend keeps the anchor where it is, which is what turns two cells into a rectangle. |
FTableCellRef | GetCursorCell | |
FTableCellRef | GetAnchorCell | |
bool | IsCellSelected | |
void | ClearSelection | |
void | GetSelectionBounds | The selection is a RECTANGLE, not a free set: that is what lets a consumer describe a bulk edit as "this column, these rows" instead of replaying an arbitrary cell list. |
FTableViewRange | ComputeVisibleRange | The virtualization decision, pure and static so the suite can pin it without a device, a font or a widget tree. |
float | ColumnOffset | Sum of the widths left of column; column == size() gives the total. |
float | ComputeContentWidth | Columns fill the viewport until they hit their minimums; past that the table scrolls sideways rather than crushing them to nothing. |
const FTableViewRange& | GetVisibleRange | |
int32_t | GetInstantiatedCellCount | |
TSharedPtr<AWidget> | GetCellWidget | |
ArcVec2 | ComputeDesiredSize | |
void | ArrangeChildren | |
int32_t | OnPaint | |
CReply | OnMouseButtonDown | |
CReply | OnMouseButtonUp | |
CReply | OnMouseMove | |
CReply | OnMouseWheel | |
CReply | OnMouseButtonDoubleClick | |
CReply | OnKeyDown | |
void | OnMouseLeave | |
bool | IsFocusable | |
int32_t | GetNumChildren | |
TSharedPtr<AWidget> | GetChildAt | |
bool | CanCacheDesiredSize | A constant: it takes what its slot gives it and scrolls the rest. |
bool | DesiredSizeDependsOnChildren | |
const char* | GetTypeName |
Function details
ARC_WIDGET_ARGS
ARC_WIDGET_ARGS(ATableView) ARC_ARG(float, RowHeight) ARC_ARG(int32_t, FrozenColumns) ARC_WIDGET_ARGS_END() void Construct(const CArguments& args)SetColumns
void SetColumns(std::vector<FTableColumn> columns)GetColumns
const std::vector<FTableColumn>& GetColumns() constGetColumnCount
int32_t GetColumnCount() constSetRowCount
void SetRowCount(int32_t rows)GetRowCount
int32_t GetRowCount() constSetOnGenerateCell
void SetOnGenerateCell(COnGenerateCell generator)SetFrozenColumns
void SetFrozenColumns(int32_t count)Columns [0, count) never move under a horizontal scroll.
GetFrozenColumns
int32_t GetFrozenColumns() constSetRowHeight
void SetRowHeight(float height)GetRowHeight
float GetRowHeight() constSetStripedRows
void SetStripedRows(bool striped)A plain list of records reads cleaner without the zebra a dense spreadsheet needs, and without a cursor frame while it is not the focused widget.
SetCursorOnlyWhenFocused
void SetCursorOnlyWhenFocused(bool onlyWhenFocused)GetHeader
const TSharedPtr<ATableHeader>& GetHeader() constRefreshCells
void RefreshCells()The rows changed identity under an unchanged shape — a sort, a filter, a re-source. The visible range is still right and the cells in it are not, so they have to be regenerated rather than reused.
ScrollTo
void ScrollTo(float offsetX, float offsetY)GetScrollX
float GetScrollX() constGetScrollY
float GetScrollY() constEnsureCellVisible
void EnsureCellVisible(int32_t row, int32_t column)SetCursorCell
void SetCursorCell(int32_t row, int32_t column, bool extend)Moving the cursor with extend keeps the anchor where it is, which is what turns two cells into a rectangle.
GetCursorCell
FTableCellRef GetCursorCell() constGetAnchorCell
FTableCellRef GetAnchorCell() constIsCellSelected
bool IsCellSelected(int32_t row, int32_t column) constClearSelection
void ClearSelection()GetSelectionBounds
void GetSelectionBounds(int32_t& outFirstRow, int32_t& outLastRow, int32_t& outFirstColumn, int32_t& outLastColumn) constThe selection is a RECTANGLE, not a free set: that is what lets a consumer describe a bulk edit as "this column, these rows" instead of replaying an arbitrary cell list.
ComputeVisibleRange
static FTableViewRange ComputeVisibleRange(int32_t rowCount, float rowHeight, float scrollY, float viewportHeight, const std::vector<float>& columnWidths, int32_t frozenColumns, float scrollX, float viewportWidth)The virtualization decision, pure and static so the suite can pin it without a device, a font or a widget tree. columnWidths is what ATableHeader::LayoutColumns produced for the CONTENT width, not the viewport width — the two differ exactly when the table scrolls sideways.
ColumnOffset
static float ColumnOffset(const std::vector<float>& widths, int32_t column)Sum of the widths left of column; column == size() gives the total.
ComputeContentWidth
static float ComputeContentWidth(const std::vector<FTableColumn>& columns, float viewportWidth)Columns fill the viewport until they hit their minimums; past that the table scrolls sideways rather than crushing them to nothing.
GetVisibleRange
const FTableViewRange& GetVisibleRange() constGetInstantiatedCellCount
int32_t GetInstantiatedCellCount() constGetCellWidget
TSharedPtr<AWidget> GetCellWidget(int32_t row, int32_t column) constComputeDesiredSize
ArcVec2 ComputeDesiredSize(float scale) const overrideArrangeChildren
void ArrangeChildren(const CGeometry& allottedGeo) overrideOnPaint
int32_t OnPaint(const CArcPaintArgs& args, const CGeometry& geo, CArcUIRenderer& renderer, int32_t layerId) const overrideOnMouseButtonDown
CReply OnMouseButtonDown(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseButtonUp
CReply OnMouseButtonUp(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseMove
CReply OnMouseMove(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseWheel
CReply OnMouseWheel(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseButtonDoubleClick
CReply OnMouseButtonDoubleClick(const CGeometry& geo, const CPointerEvent& event) overrideOnKeyDown
CReply OnKeyDown(const CGeometry& geo, const CKeyEvent& event) overrideOnMouseLeave
void OnMouseLeave(const CPointerEvent& event) overrideIsFocusable
bool IsFocusable() const overrideGetNumChildren
int32_t GetNumChildren() const overrideGetChildAt
TSharedPtr<AWidget> GetChildAt(int32_t index) const overrideCanCacheDesiredSize
bool CanCacheDesiredSize() const overrideA constant: it takes what its slot gives it and scrolls the rest. Cells are generated during arrange and never enter this widget's own measure, so neither scrolling nor regeneration can move the answer — the same reasoning AListView opts in under.
DesiredSizeDependsOnChildren
bool DesiredSizeDependsOnChildren() const overrideGetTypeName
const char* GetTypeName() const override