objects/label.go

20 lines
438 B
Go
Raw Normal View History

2023-08-08 10:46:19 -06:00
package objects
import "git.tebibyte.media/tomo/tomo"
// Label is a simple text label.
2023-08-09 09:35:24 -06:00
type Label struct {
tomo.TextBox
}
2023-08-08 10:46:19 -06:00
// NewLabel creates a new text label.
2023-08-09 09:35:24 -06:00
func NewLabel (text string) *Label {
this := &Label { TextBox: tomo.NewTextBox() }
2024-07-21 09:48:28 -06:00
this.SetRole(tomo.R("objects", "Label"))
2023-08-09 09:35:24 -06:00
this.SetText(text)
2024-07-21 09:48:28 -06:00
this.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle))
2024-07-26 19:00:53 -06:00
this.SetSelectable(true)
this.SetFocusable(true)
2023-08-09 09:35:24 -06:00
return this
2023-08-08 10:46:19 -06:00
}