Add placeholder methods for recommended sizes
This commit is contained in:
parent
1069ae6455
commit
95d3dc3288
@ -42,6 +42,7 @@ func (contract Contract) MinimumSize (hints tomo.LayoutHints, boxes []tomo.Box)
|
||||
}
|
||||
|
||||
func (contract Contract) Arrange (hints tomo.LayoutHints, boxes []tomo.Box) {
|
||||
// TODO if we overflow in a direction, respect the reccomended size
|
||||
if contract.v() {
|
||||
dot := hints.Bounds.Min
|
||||
for index, box := range boxes {
|
||||
@ -93,5 +94,15 @@ func (contract Contract) Arrange (hints tomo.LayoutHints, boxes []tomo.Box) {
|
||||
}
|
||||
}
|
||||
|
||||
func (contract Contract) RecommendedHeight (hints tomo.LayoutHints, boxes []tomo.Box, width int) int {
|
||||
// TODO
|
||||
return 0
|
||||
}
|
||||
|
||||
func (contract Contract) RecommendedWidth (hints tomo.LayoutHints, boxes []tomo.Box, height int) int {
|
||||
// TODO
|
||||
return 0
|
||||
}
|
||||
|
||||
func (contract Contract) v () bool { return contract == ContractVertical }
|
||||
func (contract Contract) h () bool { return contract == ContractHorizontal }
|
||||
|
@ -123,3 +123,13 @@ func (flow Flow) deltaMinor (rectangle image.Rectangle) int {
|
||||
func (flow Flow) fallback () tomo.Layout {
|
||||
return Contract(flow)
|
||||
}
|
||||
|
||||
func (flow Flow) RecommendedHeight (hints tomo.LayoutHints, boxes []tomo.Box, width int) int {
|
||||
// TODO
|
||||
return 0
|
||||
}
|
||||
|
||||
func (flow Flow) RecommendedWidth (hints tomo.LayoutHints, boxes []tomo.Box, height int) int {
|
||||
// TODO
|
||||
return 0
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import "math"
|
||||
import "image"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
|
||||
var _ tomo.Layout = Grid { }
|
||||
var _ tomo.Layout = new(Grid)
|
||||
|
||||
// Grid is a layout that arranges boxes in a grid formation with distinct rows
|
||||
// and columns. It is great for creating forms.
|
||||
@ -108,3 +108,13 @@ func expand (hints tomo.LayoutHints, sizes []int, space int, expands func (int)
|
||||
func ceilDiv (x, y int) int {
|
||||
return int(math.Ceil(float64(x) / float64(y)))
|
||||
}
|
||||
|
||||
func (this *Grid) RecommendedHeight (hints tomo.LayoutHints, boxes []tomo.Box, width int) int {
|
||||
// TODO
|
||||
return 0
|
||||
}
|
||||
|
||||
func (this *Grid) RecommendedWidth (hints tomo.LayoutHints, boxes []tomo.Box, height int) int {
|
||||
// TODO
|
||||
return 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user