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>
23 lines
709 B
Go
23 lines
709 B
Go
package input
|
|
|
|
import (
|
|
"github.com/egoist/mygo/ui"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
|
)
|
|
|
|
type FieldsetOptions struct{}
|
|
|
|
// Fieldset frames a group of fields under a legend.
|
|
func Fieldset(c *ui.Context, legend string, o FieldsetOptions, content func()) ui.Element {
|
|
k := pixel.K(c)
|
|
lw := pixel.Measure(legend)
|
|
return ui.Column(c).Padding(k.D(pixel.LineHeight), k.D(8), k.D(8), k.D(8)).Gap(k.D(6)).Role(ui.RoleGroup).Label(legend).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
g := k.Canvas(p, r)
|
|
top := pixel.LineHeight / 2
|
|
g.Frame(0, top, g.W, g.H-top, pixel.Double, pixel.Face)
|
|
g.Rect(6, top-1, lw+6, 4, pixel.Face)
|
|
g.Text(9, 0, legend, pixel.Accent, 1)
|
|
}).Children(content)
|
|
}
|