giowrap/examples/ctx.go

37 lines
762 B
Go

{
ctx.Reset(&e) // ctx keeps a pointer to e.Config, so we can do...
ctx.RigidConstraints()
{
f1 := layout.Flex{Axis: layout.Vertical} // maybe pass ctx in here?
ins := layout.UniformInset(ui.Dp(10))
ins.Begin(ctx) // containers like Insets and Flex keep a pointer to ctx
f1.Init(ctx)
f1.Rigid()
editor1.Layout(ctx)
f1.End()
{
f1.Flexible(0.33)
ins := layout.UniformInset(ui.Dp(10))
ins.Begin(ctx)
editor2.Layout(ctx)
ins.End()
}
f1.End()
{
f1.Flexible(0.67)
f2 := layout.Flex{Axis: layout.Horizontal}
f2.Init(ctx)
f2.Rigid()
button1.Layout(ctx)
c1 := f2.End()
f2.Flexible(0.5)
button2.Layout(ctx)
c2 := f2.End()
f2.Layout(c1, c2)
}
c3 := f1.End()
f1.Layout(c1, c2, c3)
ins.End()
}
}