summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--table.go6
-rw-r--r--yz_icons_test.go10
-rw-r--r--zz_test.go4
3 files changed, 6 insertions, 14 deletions
diff --git a/table.go b/table.go
index 38e6292..ec5bf83 100644
--- a/table.go
+++ b/table.go
@@ -10,7 +10,7 @@ import (
// Table is a Control that displays a list of like-structured data in a grid where each row represents an item and each column represents a bit of data.
// Tables store and render a slice of struct values.
-// Each field of the struct of type ImageIndex is rendered as an icon from the Table's ImageList.
+// Each field of the struct of type *image.RGBA is rendered as an icom.
// Each field whose type is bool or equivalent to bool is rendered as a checkbox.
// All other fields are rendered as strings formatted with package fmt's %v format specifier.
//
@@ -37,10 +37,6 @@ type Table interface {
// Do not call this outside a Lock()..Unlock() or RLock()..RUnlock() pair.
Data() interface{}
- // LoadImageList loads the given ImageList into the Table.
- // This function copies; changes to the ImageList made later will not be reflected by the Table.
- LoadImageList(imagelist ImageList)
-
// Selected and Select get and set the currently selected item in the Table.
// Selected returns -1 if no item is selected.
// Pass -1 to Select to deselect all items.
diff --git a/yz_icons_test.go b/yz_icons_test.go
index 4de4c27..594a633 100644
--- a/yz_icons_test.go
+++ b/yz_icons_test.go
@@ -12,15 +12,14 @@ import (
type icon struct {
Bool bool
- Icon ImageIndex
+ Icon *image.RGBA
Name string
}
var firstimg *image.RGBA
-func readIcons() ([]icon, ImageList) {
+func readIcons() []icon {
out := make([]icon, len(icons))
- outil := NewImageList()
for i := range icons {
r := bytes.NewReader(icons[i].data)
png, _, err := image.Decode(r)
@@ -32,11 +31,10 @@ func readIcons() ([]icon, ImageList) {
if firstimg == nil {
firstimg = img
}
- out[i].Icon = ImageIndex(i)
+ out[i].Icon = img
out[i].Name = icons[i].name
- outil.Append(img)
}
- return out, outil
+ return out
}
func tileImage(times int) *image.RGBA {
diff --git a/zz_test.go b/zz_test.go
index 478d3ea..6fa36c8 100644
--- a/zz_test.go
+++ b/zz_test.go
@@ -67,7 +67,6 @@ type testwin struct {
openbtn Button
fnlabel Label
icons []icon
- il ImageList
icontbl Table
group2 Group
group Group
@@ -185,7 +184,7 @@ func (tw *testwin) make(done chan struct{}) {
tw.roro.SetText(tw.roenter.Text())
})
tw.t.Append("Read-Only", newVerticalStack(tw.roenter, tw.roro))
- tw.icons, tw.il = readIcons() // repainter uses these
+ tw.icons = readIcons() // repainter uses these
tw.repainter = newRepainter(15)
tw.t.Append("Repaint", tw.repainter.grid)
tw.addfe()
@@ -194,7 +193,6 @@ func (tw *testwin) make(done chan struct{}) {
idq := tw.icontbl.Data().(*[]icon)
*idq = tw.icons
tw.icontbl.Unlock()
- tw.icontbl.LoadImageList(tw.il)
tw.icontbl.OnSelected(func() {
s := fmt.Sprintf("%d ", tw.icontbl.Selected())
tw.icontbl.RLock()