MCPcopy
hub / github.com/rivo/tview / TableContent

Interface TableContent

table.go:234–276  ·  view source on GitHub ↗

TableContent defines a Table's data. You may replace a Table's default implementation with your own using the Table.SetContent() function. This will allow you to turn Table into a view of your own data structure. The Table.Draw() function, which is called when the screen is updated, will then use th

Source from the content-addressed store, hash-verified

232// package (provided that users of the package don't call Table.Draw() in a
233// separate goroutine, which would be uncommon and is not encouraged).
234type TableContent interface {
235 // Return the cell at the given position or nil if there is no cell. The
236 // row and column arguments start at 0 and end at what GetRowCount() and
237 // GetColumnCount() return, minus 1.
238 GetCell(row, column int) *TableCell
239
240 // Return the total number of rows in the table.
241 GetRowCount() int
242
243 // Return the total number of columns in the table.
244 GetColumnCount() int
245
246 // The following functions are provided for completeness reasons as the
247 // original Table implementation was not read-only. If you do not wish to
248 // forward modifying operations to your data, you may opt to leave these
249 // functions empty. To make this easier, you can include the
250 // TableContentReadOnly type in your struct. See also the
251 // demos/table/virtualtable example.
252
253 // Set the cell at the given position to the provided cell.
254 SetCell(row, column int, cell *TableCell)
255
256 // Remove the row at the given position by shifting all following rows up
257 // by one. Out of range positions may be ignored.
258 RemoveRow(row int)
259
260 // Remove the column at the given position by shifting all following columns
261 // left by one. Out of range positions may be ignored.
262 RemoveColumn(column int)
263
264 // Insert a new empty row at the given position by shifting all rows at that
265 // position and below down by one. Implementers may decide what to do with
266 // out of range positions.
267 InsertRow(row int)
268
269 // Insert a new empty column at the given position by shifting all columns
270 // at that position and to the right by one to the right. Implementers may
271 // decide what to do with out of range positions.
272 InsertColumn(column int)
273
274 // Remove all table data.
275 Clear()
276}
277
278// TableContentReadOnly is an empty struct which implements the write operations
279// of the TableContent interface. None of the implemented functions do anything.

Callers 28

GetCellMethod · 0.65
DrawMethod · 0.65
InputHandlerMethod · 0.65
MouseHandlerMethod · 0.65
mainFunction · 0.65
GetRowCountMethod · 0.65
CellAtMethod · 0.65
ScrollToEndMethod · 0.65
DrawMethod · 0.65
InputHandlerMethod · 0.65
GetColumnCountMethod · 0.65
DrawMethod · 0.65

Implementers 2

Tabletable.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…