Elements are now pass-scoped value handles: tests that read bounds after a frame bind a ui.Handle. pixel tells frames apart by the build pass's root, since the Tester clock no longer moves on its own. Fix the regressions the upgrade brought: - Clipboard reads in input handlers go through c.Services(). - MyGo notes an overlay's opener after building it, so AutoFocus inside lost it; pixel.AutoFocus focuses through a Handle, and archtest bans the raw call. Dialogs hand the focus back again. - Elements around a press stay hovered: Tooltip tells a press-given focus by focus arriving under the pointer. - The web host moves the Tester clock with real time, at most 500 ms a call, and gives components the real clock. The gallery's source index also accepts CRLF checkouts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
37 lines
1006 B
Go
37 lines
1006 B
Go
package layout
|
|
|
|
import (
|
|
"github.com/egoist/mygo/ui"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
|
)
|
|
|
|
type StatusBarOptions struct{}
|
|
|
|
// StatusBar shows segments split by sunken dividers; the first grows.
|
|
func StatusBar(c *ui.Context, segments []string, o StatusBarOptions) ui.Element {
|
|
k := pixel.K(c)
|
|
return ui.Row(c).FillWidth().Height(k.D(pixel.LineHeight + 3)).AlignItems(ui.Stretch).Role(ui.RoleStatus).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
g := k.Canvas(p, r)
|
|
g.Rect(0, 0, g.W, g.H, pixel.Face)
|
|
g.HLine(0, 0, g.W, pixel.Edge)
|
|
g.HLine(0, 1, g.W, pixel.Lit)
|
|
}).Children(func() {
|
|
for i, s := range segments {
|
|
if i > 0 {
|
|
ui.Box(c).Width(k.D(2)).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
g := k.Canvas(p, r)
|
|
g.VLine(0, 3, g.H-5, pixel.Shade)
|
|
g.VLine(1, 3, g.H-5, pixel.Lit)
|
|
})
|
|
}
|
|
seg := ui.Box(c).Padding(k.D(2), k.D(6), 0, k.D(6)).Children(func() {
|
|
pixel.Text(c, s, pixel.TextOptions{})
|
|
})
|
|
if i == 0 {
|
|
seg.Grow(1).Clip()
|
|
}
|
|
}
|
|
})
|
|
}
|