package tins2020

import "github.com/veandco/go-sdl2/sdl"

var _ Control = &Proxy{}

type Proxy struct {
	Proxied Control
}

func (p *Proxy) Arrange(ctx *Context, bounds Rectangle) {
	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)
}