Element methods are now more consistent and have less bool flags

Still need to update most examples...
This commit is contained in:
2023-04-18 13:14:10 -04:00
parent a2b1ac0c73
commit 14080b1f88
17 changed files with 209 additions and 653 deletions

View File

@@ -24,20 +24,25 @@ type Label struct {
theme theme.Wrapped
}
// NewLabel creates a new label. If wrap is set to true, the text inside will be
// wrapped.
func NewLabel (text string, wrap bool) (element *Label) {
// NewLabel creates a new label.
func NewLabel (text string) (element *Label) {
element = &Label { }
element.theme.Case = tomo.C("tomo", "label")
element.entity = tomo.NewEntity(element).(tomo.FlexibleEntity)
element.drawer.SetFace (element.theme.FontFace (
tomo.FontStyleRegular,
tomo.FontSizeNormal))
element.SetWrap(wrap)
element.SetText(text)
return
}
// NewLabelWrapped creates a new label with text wrapping on.
func NewLabelWrapped (text string) (element *Label) {
element = NewLabel(text)
element.SetWrap(true)
return
}
// Entity returns this element's entity.
func (element *Label) Entity () tomo.Entity {
return element.entity