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

This commit is contained in:
Guendisch, Dieter 2019-01-18 20:14:12 +01:00
parent 1ac6fbc0c2
commit 55dadc0057
1 changed files with 16 additions and 0 deletions

View File

@ -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 {
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.