Fix up objects code
This commit is contained in:
parent
95d3dc3288
commit
1596d54834
@ -28,7 +28,6 @@ func newContainer (layout tomo.Layout, children ...tomo.Object) *Container {
|
|||||||
func NewOuterContainer (layout tomo.Layout, children ...tomo.Object) *Container {
|
func NewOuterContainer (layout tomo.Layout, children ...tomo.Object) *Container {
|
||||||
this := newContainer(layout, children...)
|
this := newContainer(layout, children...)
|
||||||
this.SetRole(tomo.R("objects", "Container", "outer"))
|
this.SetRole(tomo.R("objects", "Container", "outer"))
|
||||||
tomo.Apply(this)
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +36,6 @@ func NewOuterContainer (layout tomo.Layout, children ...tomo.Object) *Container
|
|||||||
func NewSunkenContainer (layout tomo.Layout, children ...tomo.Object) *Container {
|
func NewSunkenContainer (layout tomo.Layout, children ...tomo.Object) *Container {
|
||||||
this := newContainer(layout, children...)
|
this := newContainer(layout, children...)
|
||||||
this.SetRole(tomo.R("objects", "Container", "sunken"))
|
this.SetRole(tomo.R("objects", "Container", "sunken"))
|
||||||
tomo.Apply(this)
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +43,6 @@ func NewSunkenContainer (layout tomo.Layout, children ...tomo.Object) *Container
|
|||||||
func NewInnerContainer (layout tomo.Layout, children ...tomo.Object) *Container {
|
func NewInnerContainer (layout tomo.Layout, children ...tomo.Object) *Container {
|
||||||
this := newContainer(layout, children...)
|
this := newContainer(layout, children...)
|
||||||
this.SetRole(tomo.R("objects", "Container", "inner"))
|
this.SetRole(tomo.R("objects", "Container", "inner"))
|
||||||
tomo.Apply(this)
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,6 +335,14 @@ func (this scrollbarLayout) Arrange (hints tomo.LayoutHints, boxes []tomo.Box) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this scrollbarLayout) RecommendedHeight (tomo.LayoutHints, []tomo.Box, int) int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this scrollbarLayout) RecommendedWidth (tomo.LayoutHints, []tomo.Box, int) int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (this scrollbarLayout) viewportContentRatio () float64 {
|
func (this scrollbarLayout) viewportContentRatio () float64 {
|
||||||
if this.linked == nil { return 0 }
|
if this.linked == nil { return 0 }
|
||||||
return this.viewportLength() / this.contentLength()
|
return this.viewportLength() / this.contentLength()
|
||||||
|
@ -133,6 +133,7 @@ func (this *ScrollContainer) handleScroll (x, y float64) {
|
|||||||
Sub(image.Pt(int(x), int(y))))
|
Sub(image.Pt(int(x), int(y))))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove this and replace it with something from the layouts package
|
||||||
type scrollContainerLayout struct {
|
type scrollContainerLayout struct {
|
||||||
root tomo.ContentObject
|
root tomo.ContentObject
|
||||||
horizontal *Scrollbar
|
horizontal *Scrollbar
|
||||||
@ -183,6 +184,14 @@ func (this *scrollContainerLayout) Arrange (hints tomo.LayoutHints, boxes []tomo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *scrollContainerLayout) RecommendedHeight (tomo.LayoutHints, []tomo.Box, int) int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *scrollContainerLayout) RecommendedWidth (tomo.LayoutHints, []tomo.Box, int) int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func max (x, y int) int {
|
func max (x, y int) int {
|
||||||
if x > y { return x }
|
if x > y { return x }
|
||||||
return y
|
return y
|
||||||
|
@ -238,3 +238,11 @@ func (this sliderLayout) Arrange (hints tomo.LayoutHints, boxes []tomo.Box) {
|
|||||||
Add(gutter.Min))
|
Add(gutter.Min))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this sliderLayout) RecommendedHeight (tomo.LayoutHints, []tomo.Box, int) int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this sliderLayout) RecommendedWidth (tomo.LayoutHints, []tomo.Box, int) int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user