Documentation ¶
Overview ¶
Package constraint implements a constraint-based layout system. See http://gomatcha.io/guide/layout for more details.
Index ¶
- type Anchor
- type Guide
- func (g *Guide) Bottom() *Anchor
- func (g *Guide) CenterX() *Anchor
- func (g *Guide) CenterY() *Anchor
- func (g *Guide) Height() *Anchor
- func (g *Guide) Left() *Anchor
- func (g *Guide) Right() *Anchor
- func (g *Guide) Solve(solveFunc func(*Solver))
- func (g *Guide) Top() *Anchor
- func (g *Guide) Width() *Anchor
- type Layouter
- func (l *Layouter) Add(v view.View, solveFunc func(*Solver)) *Guide
- func (l *Layouter) Layout(ctx layout.Context) (layout.Guide, []layout.Guide)
- func (l *Layouter) MaxGuide() *Guide
- func (l *Layouter) MinGuide() *Guide
- func (l *Layouter) Notify(f func()) comm.Id
- func (l *Layouter) Solve(solveFunc func(*Solver))
- func (l *Layouter) Unnotify(id comm.Id)
- func (l *Layouter) Views() []view.View
- type Solver
- func (s *Solver) Bottom(v float64)
- func (s *Solver) BottomEqual(a *Anchor)
- func (s *Solver) BottomGreater(a *Anchor)
- func (s *Solver) BottomLess(a *Anchor)
- func (s *Solver) CenterX(v float64)
- func (s *Solver) CenterXEqual(a *Anchor)
- func (s *Solver) CenterXGreater(a *Anchor)
- func (s *Solver) CenterXLess(a *Anchor)
- func (s *Solver) CenterY(v float64)
- func (s *Solver) CenterYEqual(a *Anchor)
- func (s *Solver) CenterYGreater(a *Anchor)
- func (s *Solver) CenterYLess(a *Anchor)
- func (s *Solver) Debug()
- func (s *Solver) Height(v float64)
- func (s *Solver) HeightEqual(a *Anchor)
- func (s *Solver) HeightGreater(a *Anchor)
- func (s *Solver) HeightLess(a *Anchor)
- func (s *Solver) Left(v float64)
- func (s *Solver) LeftEqual(a *Anchor)
- func (s *Solver) LeftGreater(a *Anchor)
- func (s *Solver) LeftLess(a *Anchor)
- func (s *Solver) Right(v float64)
- func (s *Solver) RightEqual(a *Anchor)
- func (s *Solver) RightGreater(a *Anchor)
- func (s *Solver) RightLess(a *Anchor)
- func (s *Solver) String() string
- func (s *Solver) Top(v float64)
- func (s *Solver) TopEqual(a *Anchor)
- func (s *Solver) TopGreater(a *Anchor)
- func (s *Solver) TopLess(a *Anchor)
- func (s *Solver) Width(v float64)
- func (s *Solver) WidthEqual(a *Anchor)
- func (s *Solver) WidthGreater(a *Anchor)
- func (s *Solver) WidthLess(a *Anchor)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anchor ¶
type Anchor struct {
// contains filtered or unexported fields
}
Anchor represents a float64 value that is materialized during the layout phase.
func Notifier ¶
func Notifier(n comm.Float64Notifier) *Anchor
Notifier returns a new Anchor whose value is equal to n.Value().
type Guide ¶
type Guide struct {
// contains filtered or unexported fields
}
Guide represents a layout.Guide that is materialized during the layout phase.
type Layouter ¶
type Layouter struct { // Guide represents the size of the view that the layouter is attached to. By default, Guide is the same size as MinGuide. Guide // contains filtered or unexported fields }
func (*Layouter) Add ¶
Add immediately calls solveFunc to generate the constraints for v. These constraints are solved by l during the layout phase. A corresponding guide is returned, which can be used to position other views or reposition v. If the view is not fully constrained it will try to match the MinGuide in dimension and center. If the child view is not fully constrained it will try to match the parent in center.
func (*Layouter) Layout ¶
Layout evaluates the constraints and returns the calculated guide and child guides.
func (*Layouter) MaxGuide ¶
MaxGuide returns a guide representing the largest allowed size for the view.
func (*Layouter) MinGuide ¶
MinGuide returns a guide representing the smallest allowed size for the view.
func (*Layouter) Notify ¶
Notify calls f anytime a Notifier anchor changes. Other updates to the layouter, such as adding guides will not trigger the notification.
type Solver ¶
type Solver struct {
// contains filtered or unexported fields
}
Solver is a list of constraints to be applied to a view.