nasin/internal/style/attribute.go

42 lines
1.6 KiB
Go
Raw Normal View History

2024-06-11 22:19:12 -06:00
package style
2024-05-03 13:25:34 -06:00
import "image"
import "image/color"
import "golang.org/x/image/font"
import "git.tebibyte.media/tomo/tomo"
// Attr modifies one thing about an Objects's style.
2024-05-03 17:58:10 -06:00
type Attr interface { attr () int }
2024-05-03 13:25:34 -06:00
// AttrColor sets the background color of an Objects.
type AttrColor struct { color.Color }
// AttrTexture sets the texture of an Objects to a named texture.
type AttrTexture string
// AttrBorder sets the border of an Objects.
type AttrBorder []tomo.Border
// AttrMinimumSize sets the minimum size of an Objects.
type AttrMinimumSize image.Point
// AttrPadding sets the inner padding of an Objects.
type AttrPadding tomo.Inset
// AttrGap sets the gap between child Objects, if the Object is a ContainerBox.
type AttrGap image.Point
// AttrTextColor sets the text color, if the Object is a TextBox.
type AttrTextColor struct { color.Color }
2024-05-03 17:58:10 -06:00
// AttrDotColor sets the text selection color, if the Object is a TextBox.
type AttrDotColor struct { color.Color }
2024-05-03 13:25:34 -06:00
// AttrFace sets the font face, if the Object is a TextBox.
type AttrFace struct { font.Face }
2024-05-03 17:58:10 -06:00
// AttrAlign sets the alignment, if the Object is a ContentBox.
type AttrAlign struct { X, Y tomo.Align }
func (AttrColor) attr () int { return 0 }
func (AttrTexture) attr () int { return 1 }
func (AttrBorder) attr () int { return 2 }
func (AttrMinimumSize) attr () int { return 3 }
func (AttrPadding) attr () int { return 4 }
func (AttrGap) attr () int { return 5 }
func (AttrTextColor) attr () int { return 6 }
func (AttrDotColor) attr () int { return 7 }
func (AttrFace) attr () int { return 8 }
func (AttrAlign) attr () int { return 9 }