Documentation
¶
Index ¶
- type BridgeTable
- type DataSource
- type Delegate
- type TableColumn
- type TableInteraction
- type TableView
- func (tv *TableView) ActivateSelected() bool
- func (tv *TableView) AddColumn(c TableColumn)
- func (tv *TableView) Dequeue(reuseID string) *TableViewCell
- func (tv *TableView) Enqueue(c *TableViewCell)
- func (tv *TableView) GetSelectedRow() int
- func (tv *TableView) OnActivate(handler func(row int))
- func (tv *TableView) Raw() BridgeTable
- func (tv *TableView) ReloadData()
- func (tv *TableView) SelectRow(row int) bool
- func (tv *TableView) SetBackgroundColor(color fltk_bridge.Color)
- func (tv *TableView) SetCustomDraw(fn func(ctx fltk_bridge.TableContext, row, col, x, y, w, h int))
- func (tv *TableView) SetDataSource(ds DataSource)
- func (tv *TableView) SetDefaultRowHeight(h int)
- func (tv *TableView) SetDelegate(d Delegate)
- func (tv *TableView) SetHeaderHeight(h int)
- func (tv *TableView) View() *view.UIView
- type TableViewCell
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgeTable ¶
type BridgeTable interface {
SetRows(rows int)
Redraw()
SetDrawCellHandler(fn func(ctx fltk_bridge.TableContext, row, col int, x, y, w, h int))
SetEventHandler(fn func(TableInteraction) bool)
GetSelectedRow() int
SelectRow(row int)
ScrollToRow(row int)
Widget() fltk_bridge.Widget
SetColumnCount(cols int)
SetColumnWidth(col, width int)
AllowColumnResizing()
EnableColumnHeaders()
SetColumnHeaderHeight(h int)
SetBackgroundColor(color fltk_bridge.Color)
}
BridgeTable is the minimal interface TableView needs from the underlying FLTK table.
type DataSource ¶
type DataSource interface {
NumberOfRows(tv *TableView) int
CellForColumn(tv *TableView, row, col int) *TableViewCell
}
DataSource:提供行数与 Cell
type Delegate ¶
type Delegate interface {
DidSelectRow(tv *TableView, row int)
RowHeight(tv *TableView, row int) int // 返回 0 表示使用默认高度
}
Delegate:交互与布局(可选实现)
type TableColumn ¶
type TableColumn struct {
Identifier string
Title string
Width int
Align fltk_bridge.Align
}
type TableInteraction ¶ added in v0.0.30
TableInteraction describes a native table selection callback. FLTK reports Clicks=1 for a double click (the number of clicks after the first one).
type TableView ¶
type TableView struct {
// contains filtered or unexported fields
}
func (*TableView) ActivateSelected ¶ added in v0.0.30
ActivateSelected invokes the primary action for the selected row.
func (*TableView) AddColumn ¶
func (tv *TableView) AddColumn(c TableColumn)
func (*TableView) Dequeue ¶
func (tv *TableView) Dequeue(reuseID string) *TableViewCell
func (*TableView) Enqueue ¶
func (tv *TableView) Enqueue(c *TableViewCell)
func (*TableView) GetSelectedRow ¶
GetSelectedRow returns the 0-based index of the selected row, or -1 if none.
func (*TableView) OnActivate ¶ added in v0.0.30
OnActivate registers the primary row action used by native double-click, Enter, and semantic debug automation.
func (*TableView) Raw ¶
func (tv *TableView) Raw() BridgeTable
Raw returns the underlying BridgeTable (e.g. for win.Raw().Add(tv.Raw().Widget())).
func (*TableView) ReloadData ¶
func (tv *TableView) ReloadData()
func (*TableView) SelectRow ¶ added in v0.0.30
SelectRow selects, reveals, and publishes a data row through the delegate. It returns false when the row is outside the current data source.
func (*TableView) SetBackgroundColor ¶ added in v0.0.22
func (tv *TableView) SetBackgroundColor(color fltk_bridge.Color)
SetBackgroundColor sets the table viewport background, including the empty area below the last row.
func (*TableView) SetCustomDraw ¶
func (tv *TableView) SetCustomDraw(fn func(ctx fltk_bridge.TableContext, row, col, x, y, w, h int))
SetCustomDraw sets a custom cell-drawing function called for every visible row. When set, it replaces the default DataSource-driven cell drawing.
func (*TableView) SetDataSource ¶
func (tv *TableView) SetDataSource(ds DataSource)
func (*TableView) SetDefaultRowHeight ¶
func (*TableView) SetDelegate ¶
func (*TableView) SetHeaderHeight ¶
type TableViewCell ¶
type TableViewCell struct {
ReuseID string
Text string
Font fltk_bridge.Font
FontSize int
TextColor fltk_bridge.Color
Align fltk_bridge.Align
Selected bool
// contains filtered or unexported fields
}
TableViewCell:UITableViewCell 的最小抽象
func NewCell ¶
func NewCell(reuseID string) *TableViewCell
func (*TableViewCell) Col ¶
func (c *TableViewCell) Col() int
func (*TableViewCell) PrepareForReuse ¶
func (c *TableViewCell) PrepareForReuse()
PrepareForReuse:复用前清理状态
func (*TableViewCell) Row ¶
func (c *TableViewCell) Row() int
func (*TableViewCell) SetText ¶
func (c *TableViewCell) SetText(text string)