allg5/alui/proxy.go

45 lines
773 B
Go
Raw Normal View History

2020-03-08 09:10:41 +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
}
2020-04-10 09:00:27 +00:00
func (p *Proxy) Handle(ctx *Context, e allg5.Event) {
2020-03-08 09:10:41 +00:00
if p.Target != nil {
2020-04-10 09:00:27 +00:00
p.Target.Handle(ctx, e)
2020-03-08 09:10:41 +00:00
}
}
func (p *Proxy) Layout(ctx *Context, bounds geom.RectangleF32) {
if p.Target != nil {
p.Target.Layout(ctx, bounds)
}
}
func (p *Proxy) Render(ctx *Context, bounds geom.RectangleF32) {
if p.Target != nil {
p.Target.Render(ctx, bounds)
}
}