krampus19/alui/proxy.go

45 lines
754 B
Go
Raw Normal View History

2019-12-27 12:18:33 +00:00
package alui
import (
"opslag.de/schobers/allg5"
"opslag.de/schobers/geom"
)
var _ Control = &Proxy{}
type Proxy struct {
Target Control
}
func (p *Proxy) Bounds() geom.RectangleF32 {
if p.Target != nil {
return p.Target.Bounds()
}
return geom.RectangleF32{}
}
func (p *Proxy) DesiredSize(ctx *Context) geom.PointF32 {
if p.Target != nil {
return p.Target.DesiredSize(ctx)
}
return geom.ZeroPtF32
}
func (p *Proxy) Handle(e allg5.Event) {
if p.Target != nil {
p.Target.Handle(e)
}
}
func (p *Proxy) Render(ctx *Context, bounds geom.RectangleF32) {
if p.Target != nil {
p.Target.Render(ctx, bounds)
}
}
func (p *Proxy) Layout(ctx *Context, bounds geom.RectangleF32) {
if p.Target != nil {
p.Target.Layout(ctx, bounds)
}
}