list_page_selector.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package MusicPlayer
  2. import (
  3. //"fmt"
  4. // "path/filepath"
  5. // "github.com/cuu/gogame/event"
  6. "github.com/cuu/gogame/draw"
  7. "github.com/cuu/gogame/rect"
  8. // "github.com/cuu/gogame/surface"
  9. // "github.com/veandco/go-sdl2/ttf"
  10. "github.com/cuu/gogame/color"
  11. // "github.com/clockworkpi/LauncherGoDev/sysgo"
  12. "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
  13. )
  14. type ListPageSelector struct {
  15. UI.InfoPageSelector
  16. }
  17. func NewListPageSelector() *ListPageSelector {
  18. p := &ListPageSelector{}
  19. p.Width = UI.Width
  20. p.BackgroundColor = &color.Color{131, 199, 219, 255} //SkinManager().GiveColor('Front')
  21. return p
  22. }
  23. func (self *ListPageSelector) Draw() {
  24. idx := self.Parent.GetPsIndex()
  25. mylist := self.Parent.GetMyList()
  26. if idx < len(mylist) {
  27. x, y := mylist[idx].Coord()
  28. _, h := mylist[idx].Size()
  29. self.PosX = x + 2
  30. self.PosY = y + 1
  31. self.Height = h - 3
  32. canvas_ := self.Parent.GetCanvasHWND()
  33. rect_ := rect.Rect(self.PosX, self.PosY, self.Width-4, self.Height)
  34. draw.AARoundRect(canvas_, &rect_, self.BackgroundColor, 4, 0, self.BackgroundColor)
  35. }
  36. }