Initial Upload
Has basic functionality, still need to work on some stuff though
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/nelsam/gxui"
|
||||
"github.com/nelsam/gxui/math"
|
||||
)
|
||||
|
||||
type prtapAdap struct {
|
||||
gxui.AdapterBase
|
||||
apps []prtap
|
||||
}
|
||||
|
||||
func (p *prtapAdap) SetApps(apps []prtap) {
|
||||
p.apps = apps
|
||||
p.DataChanged(false)
|
||||
}
|
||||
|
||||
func (p *prtapAdap) Count() int {
|
||||
return len(p.apps)
|
||||
}
|
||||
|
||||
func (p *prtapAdap) Create(th gxui.Theme, index int) gxui.Control {
|
||||
box := th.CreateLinearLayout()
|
||||
box.SetDirection(gxui.LeftToRight)
|
||||
// pic := th.CreateImage()
|
||||
// dr.CreateTexture()
|
||||
//add image support
|
||||
lbl := th.CreateLabel()
|
||||
lbl.SetText(p.apps[index].name)
|
||||
// box.AddChild(pic)
|
||||
box.AddChild(lbl)
|
||||
return box
|
||||
}
|
||||
|
||||
func (p *prtapAdap) ItemAt(index int) gxui.AdapterItem {
|
||||
return p.apps[index]
|
||||
}
|
||||
|
||||
func (p *prtapAdap) ItemIndex(item gxui.AdapterItem) int {
|
||||
it, ok := item.(prtap)
|
||||
if !ok {
|
||||
return -1
|
||||
}
|
||||
for i, v := range p.apps {
|
||||
if v == it {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func (p *prtapAdap) Size(gxui.Theme) math.Size {
|
||||
return math.Size{W: math.MaxSize.W, H: 20}
|
||||
}
|
||||
Reference in New Issue
Block a user