Update Gio version.

This commit is contained in:
Greg 2019-09-01 20:21:14 -04:00
parent f134a1f21e
commit 11e2dbad38
5 changed files with 14 additions and 14 deletions

View File

@ -158,9 +158,9 @@ func main1() {
giowrap.RecordMallocs() giowrap.RecordMallocs()
} }
} }
ctx = ctx.Reset(&e) ctx.Reset(&e)
giowrap.Mallocs("pre-layout") giowrap.Mallocs("pre-layout")
ctx = (*page).Layout(ctx) (*page).Layout(ctx)
giowrap.Mallocs("post-layout") giowrap.Mallocs("post-layout")
ctx.Update() ctx.Update()
for i, w := range btns { for i, w := range btns {

View File

@ -43,7 +43,7 @@ func main() {
app.Main() app.Main()
} }
func layoutRect(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimens { func layoutRect(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimensions {
ins := layout.UniformInset(ui.Px(10)) ins := layout.UniformInset(ui.Px(10))
cs = ins.Begin(c, ops, cs) cs = ins.Begin(c, ops, cs)
paint.PaintOp{Rect: f32.Rectangle{ paint.PaintOp{Rect: f32.Rectangle{
@ -52,7 +52,7 @@ func layoutRect(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimens {
Y: float32(cs.Width.Max), Y: float32(cs.Width.Max),
}, },
}}.Add(ops) }}.Add(ops)
dims := layout.Dimens{ dims := layout.Dimensions{
Size: image.Point{ Size: image.Point{
X: cs.Width.Max, X: cs.Width.Max,
Y: cs.Width.Max, Y: cs.Width.Max,

View File

@ -484,7 +484,7 @@ func main4() {
} }
} }
var dims layout.Dimens var dims layout.Dimensions
cs := layout.RigidConstraints(e.Size) cs := layout.RigidConstraints(e.Size)
{ {
f1 := layout.Flex{Axis: layout.Vertical} f1 := layout.Flex{Axis: layout.Vertical}
@ -535,14 +535,14 @@ func main4() {
} }
} }
func layoutRRect(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimens { func layoutRRect(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimensions {
r := float32(c.Px(ui.Dp(4))) r := float32(c.Px(ui.Dp(4)))
sz := image.Point{X: cs.Width.Min, Y: cs.Height.Min} sz := image.Point{X: cs.Width.Min, Y: cs.Height.Min}
w, h := float32(sz.X), float32(sz.Y) w, h := float32(sz.X), float32(sz.Y)
giowrap.Rrect(ops, w, h, r, r, r, r) giowrap.Rrect(ops, w, h, r, r, r, r)
paint.ColorOp{Color: color.RGBA{A: 0xff, R: 0x3c, G: 0x98, B: 0xc6}}.Add(ops) paint.ColorOp{Color: color.RGBA{A: 0xff, R: 0x3c, G: 0x98, B: 0xc6}}.Add(ops)
paint.PaintOp{Rect: f32.Rectangle{Max: f32.Point{X: w, Y: h}}}.Add(ops) paint.PaintOp{Rect: f32.Rectangle{Max: f32.Point{X: w, Y: h}}}.Add(ops)
return layout.Dimens{Size: sz} return layout.Dimensions{Size: sz}
} }
type Button struct { type Button struct {
@ -551,10 +551,10 @@ type Button struct {
Click gesture.Click Click gesture.Click
} }
func (b *Button) Layout(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimens { func (b *Button) Layout(c ui.Config, ops *ui.Ops, cs layout.Constraints) layout.Dimensions {
ins := layout.UniformInset(ui.Dp(10)) ins := layout.UniformInset(ui.Dp(10))
cs = ins.Begin(c, ops, cs) cs = ins.Begin(c, ops, cs)
var dims layout.Dimens var dims layout.Dimensions
st := layout.Stack{} st := layout.Stack{}
st.Init(ops, cs) st.Init(ops, cs)
{ {

View File

@ -20,7 +20,7 @@ type Grid struct {
} }
type GridChild struct { type GridChild struct {
dims layout.Dimens dims layout.Dimensions
macro ui.MacroOp macro ui.MacroOp
} }
@ -57,7 +57,7 @@ func (g *Grid) Begin() {
g.macro.Record(g.ops) g.macro.Record(g.ops)
} }
func (g *Grid) End(dims layout.Dimens) GridChild { func (g *Grid) End(dims layout.Dimensions) GridChild {
if g.mode != modeBegun { if g.mode != modeBegun {
panic("Must call Grid.Begin() before adding children.") panic("Must call Grid.Begin() before adding children.")
} }
@ -65,7 +65,7 @@ func (g *Grid) End(dims layout.Dimens) GridChild {
return GridChild{dims: dims, macro: g.macro} return GridChild{dims: dims, macro: g.macro}
} }
func (g *Grid) Layout(cs ...GridChild) layout.Dimens { func (g *Grid) Layout(cs ...GridChild) layout.Dimensions {
rowheight := 0 rowheight := 0
height := 0 height := 0
var width float32 var width float32
@ -110,7 +110,7 @@ func (g *Grid) Layout(cs ...GridChild) layout.Dimens {
} else { } else {
dwidth = g.cs.Width.Max dwidth = g.cs.Width.Max
} }
return layout.Dimens{Size: image.Point{dwidth, height}} return layout.Dimensions{Size: image.Point{dwidth, height}}
} }
func toPointF(p image.Point) f32.Point { func toPointF(p image.Point) f32.Point {

View File

@ -47,7 +47,7 @@ type Context struct {
q input.Queue q input.Queue
ops *ui.Ops ops *ui.Ops
cs layout.Constraints cs layout.Constraints
dims layout.Dimens dims layout.Dimensions
container Widget container Widget
} }