Module: reefvision.widgets.table

Source: ./reefvision/widgets/table.reef


Overview

reefvision.widgets.table — columns, header row, row selection (Wave 5)

object Table extends view.View. Layout: one header row + body rows. Selection is a single body row. Vertical scroll when row_count > visible_rows. No horizontal scroll (v1). Insertion is Group.add.

Usage: let t = new table.Table(cell.rect(0, 8, 48, 6), 3, 32, 4) t.set_header(0, "Name") let _ = t.add_row() t.set_cell(0, 0, "main.reef") win.add(t)


Objects

Table

Extends: view.View

Fields:

Name Type
headers [string]
col_widths [int]
col_count int
cells [string]
max_rows int
row_count int
selected int
offset int
visible_rows int

proc init(bounds: cell.Rect, col_count: int, max_rows: int, visible_rows: int)

Methods:

override shared fn wants_focus(): bool

shared fn col_count(): int

shared fn row_count(): int

shared fn selected(): int

shared fn offset(): int

shared fn visible_rows(): int

shared fn has_scrollbar(): bool

exclusive proc set_header(col: int, title: string)

exclusive proc set_col_width(col: int, width: int)

shared fn header(col: int): string

shared fn col_width(col: int): int

shared fn cell_index(row: int, col: int): int

exclusive fn add_row(): bool

exclusive proc set_cell(row: int, col: int, text: string)

shared fn cell(row: int, col: int): string

exclusive proc clear()

exclusive proc set_selected(row: int)

exclusive proc ensure_visible()

exclusive proc scroll_by(delta: int)

override exclusive proc draw(buf: cell.CellBuffer, abs: cell.Rect, clip: cell.Rect, focused: bool, th: theme.Theme)

override exclusive fn handle_event(e: event.Event): view.EventResult

exclusive fn handle_mouse(e: event.Event): bool


Functions

fn max_cols(): int

fn max_rows_cap(): int

fn pad_or_trunc(s: string, width: int): string


Generated by reefc doc