diff options
| author | Pietro Gagliardi <[email protected]> | 2015-02-20 00:23:49 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-02-20 00:23:49 -0500 |
| commit | d855f5df3f084f57ada2add87e3d5a59a8ccbd0a (patch) | |
| tree | 45ea73b742125ffdcddc7405cec3a8f38f89475d /examples | |
| parent | 87e5e3ed857e287419c71e41dc8394f4772c1462 (diff) | |
Updated the widget gallery example to use the new Table without ImageList.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/widgetgallery/icons.go | 11 | ||||
| -rw-r--r-- | examples/widgetgallery/main.go | 3 |
2 files changed, 5 insertions, 9 deletions
diff --git a/examples/widgetgallery/icons.go b/examples/widgetgallery/icons.go index 3320c38..97d0370 100644 --- a/examples/widgetgallery/icons.go +++ b/examples/widgetgallery/icons.go @@ -9,20 +9,18 @@ import ( "image" "image/draw" _ "image/png" - "github.com/andlabs/ui" ) type icon struct { Name string - Icon ui.ImageIndex + Icon *image.RGBA Bool bool } var firstimg *image.RGBA -func readIcons() ([]icon, ui.ImageList) { +func readIcons() []icon { out := make([]icon, len(icons)) - outil := ui.NewImageList() for i := range icons { r := bytes.NewReader(icons[i].data) png, _, err := image.Decode(r) @@ -34,11 +32,10 @@ func readIcons() ([]icon, ui.ImageList) { if firstimg == nil { firstimg = img } - out[i].Icon = ui.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/examples/widgetgallery/main.go b/examples/widgetgallery/main.go index c0c811a..569c4c4 100644 --- a/examples/widgetgallery/main.go +++ b/examples/widgetgallery/main.go @@ -37,13 +37,12 @@ func initGUI() { g := ui.NewGroup("Group", ui.Space()) - icons, il := readIcons() + icons := readIcons() table := ui.NewTable(reflect.TypeOf(icons[0])) table.Lock() d := table.Data().(*[]icon) *d = icons table.Unlock() - table.LoadImageList(il) area := ui.NewArea(200, 200, &areaHandler{tileImage(20)}) |
