zntg/ui/proxy.go

73 lines
1.6 KiB
Go

package ui
import "opslag.de/schobers/geom"
var _ Control = &Proxy{}
var _ Overlay = &Proxy{}
type Proxy struct {
Content Control
}
func (p *Proxy) Arrange(ctx Context, bounds geom.RectangleF32, offset geom.PointF32, parent Control) {
p.Content.Arrange(ctx, bounds, offset, parent)
}
func (p *Proxy) DesiredSize(ctx Context, size geom.PointF32) geom.PointF32 {
return p.Content.DesiredSize(ctx, size)
}
func (p *Proxy) Handle(ctx Context, e Event) bool {
return p.Content.Handle(ctx, e)
}
func (p *Proxy) Render(ctx Context) {
p.Content.Render(ctx)
}
func (p *Proxy) Bounds() geom.RectangleF32 {
return p.Content.Bounds()
}
func (p *Proxy) BoundsUnclipped(ctx Context, path ControlPath) geom.RectangleF32 {
return path.BoundsUnclipped(ctx, p)
}
func (p *Proxy) Disable() { p.Content.Disable() }
func (p *Proxy) Enable() { p.Content.Enable() }
func (p *Proxy) Hidden() {
overlay, ok := p.Content.(Overlay)
if ok {
overlay.Hidden()
}
}
func (p *Proxy) IsDisabled() bool { return p.Content.IsDisabled() }
func (p *Proxy) IsInBounds(pt geom.PointF32) bool { return p.Content.IsInBounds(pt) }
func (p *Proxy) IsOver() bool { return p.Content.IsOver() }
func (p *Proxy) Offset() geom.PointF32 { return p.Content.Offset() }
func (p *Proxy) Parent() Control { return p.Content.Parent() }
func (p *Proxy) Shown() {
overlay, ok := p.Content.(Overlay)
if ok {
overlay.Shown()
}
}
func (p *Proxy) ScrollIntoView(ctx Context, path ControlPath) {
p.Content.Parent().ScrollIntoView(ctx, path.Prepend(p))
}
func (p *Proxy) Self() Control {
return p.Content.Self()
}
func (p *Proxy) SetSelf(self Control) { p.Content.SetSelf(self) }