Update other objects to use new methods of Label

This commit is contained in:
Sasha Koshka 2024-08-24 19:56:58 -04:00
parent c7caa5bcb6
commit 3aa4b12ffe
6 changed files with 10 additions and 10 deletions

View File

@ -31,7 +31,7 @@ func NewButton (text string) *Button {
label: NewLabel(text), label: NewLabel(text),
} }
button.box.SetRole(tomo.R("objects", "Button")) button.box.SetRole(tomo.R("objects", "Button"))
button.label.SetAttr(tomo.AAlign(tomo.AlignMiddle, tomo.AlignMiddle)) button.label.SetAlign(tomo.AlignMiddle, tomo.AlignMiddle)
button.box.SetAttr(tomo.ALayout(buttonLayout)) button.box.SetAttr(tomo.ALayout(buttonLayout))
button.SetText(text) button.SetText(text)

View File

@ -44,7 +44,7 @@ func NewCalendar (tm time.Time) *Calendar {
calendar.on.valueChange.Broadcast() calendar.on.valueChange.Broadcast()
}) })
calendar.monthLabel = NewLabel("") calendar.monthLabel = NewLabel("")
calendar.monthLabel.SetAttr(tomo.AAlign(tomo.AlignMiddle, tomo.AlignMiddle)) calendar.monthLabel.SetAlign(tomo.AlignMiddle, tomo.AlignMiddle)
calendar.grid = tomo.NewContainerBox() calendar.grid = tomo.NewContainerBox()
calendar.grid.SetRole(tomo.R("objects", "CalendarGrid")) calendar.grid.SetRole(tomo.R("objects", "CalendarGrid"))

View File

@ -56,7 +56,7 @@ func NewDialog (kind DialogKind, parent tomo.Window, title, message string, opti
dialog.SetIcon(iconId) dialog.SetIcon(iconId)
icon := NewIcon(iconId, tomo.IconSizeLarge) icon := NewIcon(iconId, tomo.IconSizeLarge)
messageText := NewLabel(message) messageText := NewLabel(message)
messageText.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle)) messageText.SetAlign(tomo.AlignStart, tomo.AlignMiddle)
for _, option := range options { for _, option := range options {
if option, ok := option.(clickable); ok { if option, ok := option.(clickable); ok {

View File

@ -23,9 +23,9 @@ func NewLabelCheckbox (value bool, text string) *LabelCheckbox {
label: NewLabel(text), label: NewLabel(text),
} }
labelCheckbox.box.SetRole(tomo.R("objects", "LabelCheckbox")) labelCheckbox.box.SetRole(tomo.R("objects", "LabelCheckbox"))
labelCheckbox.label.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle)) labelCheckbox.label.SetAlign(tomo.AlignStart, tomo.AlignMiddle)
labelCheckbox.label.SetSelectable(false) labelCheckbox.label.GetBox().(tomo.TextBox).SetSelectable(false)
labelCheckbox.label.SetFocusable(false) labelCheckbox.label.GetBox().(tomo.TextBox).SetFocusable(false)
labelCheckbox.box.Add(labelCheckbox.checkbox) labelCheckbox.box.Add(labelCheckbox.checkbox)
labelCheckbox.box.Add(labelCheckbox.label) labelCheckbox.box.Add(labelCheckbox.label)
labelCheckbox.box.SetAttr(tomo.ALayout(layouts.Row { false, true })) labelCheckbox.box.SetAttr(tomo.ALayout(layouts.Row { false, true }))

View File

@ -23,9 +23,9 @@ func NewLabelSwatch (value color.Color, text string) *LabelSwatch {
} }
box.SetRole(tomo.R("objects", "LabelSwatch")) box.SetRole(tomo.R("objects", "LabelSwatch"))
box.swatch.label = text box.swatch.label = text
box.label.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle)) box.label.SetAlign(tomo.AlignStart, tomo.AlignMiddle)
box.label.SetSelectable(false) box.label.GetBox().(tomo.TextBox).SetSelectable(false)
box.label.SetFocusable(false) box.label.GetBox().(tomo.TextBox).SetFocusable(false)
box.Add(box.swatch) box.Add(box.swatch)
box.Add(box.label) box.Add(box.label)
box.SetAttr(tomo.ALayout(layouts.Row { false, true })) box.SetAttr(tomo.ALayout(layouts.Row { false, true }))

View File

@ -31,7 +31,7 @@ func NewIconMenuItem (icon tomo.Icon, text string) *MenuItem {
icon: NewIcon(icon, tomo.IconSizeSmall), icon: NewIcon(icon, tomo.IconSizeSmall),
} }
box.SetRole(tomo.R("objects", "MenuItem")) box.SetRole(tomo.R("objects", "MenuItem"))
box.label.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle)) box.label.SetAlign(tomo.AlignStart, tomo.AlignMiddle)
box.SetAttr(tomo.ALayout(layouts.Row { false, true })) box.SetAttr(tomo.ALayout(layouts.Row { false, true }))
box.Add(box.icon) box.Add(box.icon)