nasin/internal/style/attribute.go

42 lines
1.6 KiB
Go

package style
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.
type Attr interface { attr () int }
// 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 }
// AttrDotColor sets the text selection color, if the Object is a TextBox.
type AttrDotColor struct { color.Color }
// AttrFace sets the font face, if the Object is a TextBox.
type AttrFace struct { font.Face }
// 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 }