29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
|
package style
|
||
|
|
||
|
import "git.tebibyte.media/tomo/tomo"
|
||
|
import "git.tebibyte.media/tomo/tomo/data"
|
||
|
import "git.tebibyte.media/tomo/tomo/canvas"
|
||
|
|
||
|
// IconSet holds a set of icon textures.
|
||
|
type IconSet interface {
|
||
|
// A word on textures:
|
||
|
//
|
||
|
// Because textures can be linked to some resource that is outside of
|
||
|
// the control of Go's garbage collector, methods of IconSet must not
|
||
|
// allocate new copies of a texture each time they are called. It is
|
||
|
// fine to lazily load textures and save them for later use, but the
|
||
|
// same texture must never be allocated multiple times as this could
|
||
|
// cause a memory leak.
|
||
|
//
|
||
|
// As such, textures returned by these methods must be protected.
|
||
|
|
||
|
// Icon returns a texture of the corresponding icon ID. If there is no
|
||
|
// suitable option, it should return nil.
|
||
|
Icon (tomo.Icon, tomo.IconSize) canvas.Texture
|
||
|
|
||
|
// MimeIcon returns a texture of an icon corresponding to a MIME type.
|
||
|
// If there is no suitable specific option, it should return a more
|
||
|
// generic icon or a plain file icon.
|
||
|
MimeIcon (data.Mime, tomo.IconSize) canvas.Texture
|
||
|
}
|