mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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,
|
||||
// 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.
|
||||
//
|
||||
// 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() {
|
||||
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":
|
||||
w := parseValue(state)
|
||||
expect(state, ",")
|
||||
|
||||
Reference in New Issue
Block a user