package tins2020 import "github.com/veandco/go-sdl2/sdl" var _ Control = &Proxy{} type Proxy struct { Proxied Control bounds Rectangle } func (p *Proxy) Arrange(ctx *Context, bounds Rectangle) { p.bounds = bounds if p.Proxied == nil { return } p.Proxied.Arrange(ctx, bounds) } func (p *Proxy) Handle(ctx *Context, event sdl.Event) bool { if p.Proxied == nil { return false } return p.Proxied.Handle(ctx, event) } func (p *Proxy) Init(ctx *Context) error { if p.Proxied == nil { return nil } return p.Proxied.Init(ctx) } func (p *Proxy) Render(ctx *Context) { if p.Proxied == nil { return } p.Proxied.Render(ctx) } func (p *Proxy) SetContent(ctx *Context, content Control) { p.Proxied = content if content == nil { return } content.Arrange(ctx, p.bounds) }