forked from joejulian/gio
layout: add "exp" format layout for expanding both constraints
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+8
-1
@@ -47,7 +47,7 @@ type formatError string
|
|||||||
// is one of north, northeast, east, southeast, south, southwest, west,
|
// is one of north, northeast, east, southeast, south, southwest, west,
|
||||||
// northwest, center.
|
// northwest, center.
|
||||||
//
|
//
|
||||||
// hexpand/vexpand(widget) forces the horizontalor or vertical
|
// hexp/vexp/exp(widget) forces the horizontal, vertical or both
|
||||||
// constraints to their maximum before laying out widget.
|
// constraints to their maximum before laying out widget.
|
||||||
//
|
//
|
||||||
// hcap/vcap(size, widget) caps the maximum horizontal or vertical
|
// hcap/vcap(size, widget) caps the maximum horizontal or vertical
|
||||||
@@ -131,6 +131,13 @@ func formatLayout(gtx *Context, state *formatState, widgets []Widget) {
|
|||||||
ctxLayout(gtx, cs, func() {
|
ctxLayout(gtx, cs, func() {
|
||||||
formatExpr(gtx, state, widgets)
|
formatExpr(gtx, state, widgets)
|
||||||
})
|
})
|
||||||
|
case "exp":
|
||||||
|
cs := gtx.Constraints
|
||||||
|
cs.Width.Min = cs.Width.Max
|
||||||
|
cs.Height.Min = cs.Height.Max
|
||||||
|
ctxLayout(gtx, cs, func() {
|
||||||
|
formatExpr(gtx, state, widgets)
|
||||||
|
})
|
||||||
case "hcap":
|
case "hcap":
|
||||||
w := parseValue(state)
|
w := parseValue(state)
|
||||||
expect(state, ",")
|
expect(state, ",")
|
||||||
|
|||||||
Reference in New Issue
Block a user