Compare commits

...

5 Commits

8 changed files with 99 additions and 37 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 {

23
icon.go
View File

@ -3,9 +3,11 @@ package objects
import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/tomo/canvas" import "git.tebibyte.media/tomo/tomo/canvas"
var _ tomo.Object = new(Icon)
// Icon displays a single icon. // Icon displays a single icon.
type Icon struct { type Icon struct {
tomo.Box box tomo.Box
icon tomo.Icon icon tomo.Icon
size tomo.IconSize size tomo.IconSize
} }