yvbolt/images.go

92 lines
2.3 KiB
Go
Raw Normal View History

package main
import (
"embed"
"github.com/ying32/govcl/vcl"
)
//go:embed assets/*
var assetsFs embed.FS
const (
2024-07-05 23:54:36 +00:00
imgAdd int32 = iota
imgArrowRefresh
imgChartBar
2024-06-14 23:42:13 +00:00
imgDatabase
imgDatabaseAdd
imgDatabaseDelete
imgDatabaseLightning
imgDatabaseSave
2024-07-05 23:54:36 +00:00
imgDelete
2024-06-14 23:42:13 +00:00
imgLightning
2024-07-05 23:54:36 +00:00
imgLightningGo
imgPencil
imgPencilAdd
imgPencilDelete
imgPencilGo
imgResultsetNext
2024-06-14 23:42:13 +00:00
imgTable
imgTableAdd
imgTableDelete
imgTableSave
2024-06-27 23:01:34 +00:00
imgVendorCockroach
2024-06-30 02:14:41 +00:00
imgVendorDebian
2024-06-23 04:29:00 +00:00
imgVendorDgraph
2024-06-23 04:18:36 +00:00
imgVendorGithub
imgVendorMySQL
imgVendorRedis
imgVendorSqlite
)
func loadImages(owner vcl.IComponent) *vcl.TImageList {
mustLoad := func(n string) *vcl.TBitmap {
imgData, err := assetsFs.ReadFile(n)
if err != nil {
panic(err)
}
png := vcl.NewPngImage()
png.LoadFromBytes(imgData)
ret := vcl.NewBitmap()
ret.Assign(png)
return ret
}
ilist := vcl.NewImageList(owner)
2024-07-05 23:54:36 +00:00
// ls assets | sort | sed -re 's~(.+)~ilist.Add(mustLoad("assets/\1"), nil)~'
ilist.Add(mustLoad("assets/add.png"), nil)
ilist.Add(mustLoad("assets/arrow_refresh.png"), nil)
2024-06-14 23:42:13 +00:00
ilist.Add(mustLoad("assets/chart_bar.png"), nil)
ilist.Add(mustLoad("assets/database.png"), nil)
ilist.Add(mustLoad("assets/database_add.png"), nil)
ilist.Add(mustLoad("assets/database_delete.png"), nil)
2024-06-14 23:42:13 +00:00
ilist.Add(mustLoad("assets/database_lightning.png"), nil)
ilist.Add(mustLoad("assets/database_save.png"), nil)
2024-07-05 23:54:36 +00:00
ilist.Add(mustLoad("assets/delete.png"), nil)
2024-06-14 23:42:13 +00:00
ilist.Add(mustLoad("assets/lightning.png"), nil)
2024-07-05 23:54:36 +00:00
ilist.Add(mustLoad("assets/lightning_go.png"), nil)
ilist.Add(mustLoad("assets/pencil.png"), nil)
ilist.Add(mustLoad("assets/pencil_add.png"), nil)
ilist.Add(mustLoad("assets/pencil_delete.png"), nil)
ilist.Add(mustLoad("assets/pencil_go.png"), nil)
ilist.Add(mustLoad("assets/resultset_next.png"), nil)
ilist.Add(mustLoad("assets/table.png"), nil)
ilist.Add(mustLoad("assets/table_add.png"), nil)
ilist.Add(mustLoad("assets/table_delete.png"), nil)
ilist.Add(mustLoad("assets/table_save.png"), nil)
2024-06-27 23:01:34 +00:00
ilist.Add(mustLoad("assets/vendor_cockroach.png"), nil)
2024-06-30 02:14:41 +00:00
ilist.Add(mustLoad("assets/vendor_debian.png"), nil)
2024-06-23 04:29:00 +00:00
ilist.Add(mustLoad("assets/vendor_dgraph.png"), nil)
2024-06-23 04:18:36 +00:00
ilist.Add(mustLoad("assets/vendor_github.png"), nil)
ilist.Add(mustLoad("assets/vendor_mysql.png"), nil)
ilist.Add(mustLoad("assets/vendor_redis.png"), nil)
ilist.Add(mustLoad("assets/vendor_sqlite.png"), nil)
2024-07-05 23:54:36 +00:00
return ilist
}