aboutsummaryrefslogtreecommitdiffstats
path: root/constraint.go
blob: c08e222442bf04c6d75e79e93191013d91b5697d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package gui

// Constraint imposes a restriction on the size of a widget or layout.
type Constraint struct {
	// Dim is the dimension to constrain: width/height.
	Dim

	// Relation declares whether the constraint is an upper, lower, or exact bound.
	Relation

	// Length is the target or threshold value.
	Length
}

// Dim is a dimension of a widget or layout that can be constrained.
type Dim int

const (
	_ Dim = iota
	Width
	Height
)

// Relation is an (in)equality.
type Relation int

const (
	_    Relation = iota
	Eq            // ==
	Gteq          // >=
	Gt            // >
	Lteq          // <=
	Lt            // <
)