More ImageList removal.

This commit is contained in:
Pietro Gagliardi 2015-02-17 17:19:31 -05:00
parent 62d9ae07ad
commit dc32a0e27a
3 changed files with 6 additions and 14 deletions

View File

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

View File

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

View File

@ -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()