Browse Source

Added a reference to TableCell. Fixes feature request #229.

tablepad
Guendisch, Dieter 4 years ago
parent
commit
55dadc0057
  1. 16
      table.go

16
table.go

@ -11,6 +11,9 @@ import ( @@ -11,6 +11,9 @@ import (
// directly but all colors (background and text) will be set to their default
// which is black.
type TableCell struct {
// The reference object.
Reference interface{}
// The text to be displayed in the table cell.
Text string
@ -132,6 +135,19 @@ func (c *TableCell) SetSelectable(selectable bool) *TableCell { @@ -132,6 +135,19 @@ func (c *TableCell) SetSelectable(selectable bool) *TableCell {
return c
}
// SetReference allows you to store a reference of any type in this cell. This
// will allow you to establish a mapping between the cell and your
// actual data.
func (c *TableCell) SetReference(reference interface{}) *TableCell {
c.Reference = reference
return c
}
// GetReference returns this cell's reference object.
func (c *TableCell) GetReference() interface{} {
return c.Reference
}
// GetLastPosition returns the position of the table cell the last time it was
// drawn on screen. If the cell is not on screen, the return values are
// undefined.

Loading…
Cancel
Save