package alui

import (
	"opslag.de/schobers/allg5"
	"opslag.de/schobers/geom"
)

type Overlay struct {
	ControlBase

	Proxy Control

	Visible bool
}

func (o *Overlay) DesiredSize(ctx *Context) geom.PointF32 {
	if o.Visible {
		return o.Proxy.DesiredSize(ctx)
	}
	return geom.ZeroPtF32
}

func (o *Overlay) Handle(e allg5.Event) {
	if o.Visible {
		o.Proxy.Handle(e)
	}
}

func (o *Overlay) Render(ctx *Context, bounds geom.RectangleF32) {
	if o.Visible {
		o.Proxy.Render(ctx, bounds)
	}
}

func (o *Overlay) Layout(ctx *Context, bounds geom.RectangleF32) {
	if o.Visible {
		o.Proxy.Layout(ctx, bounds)
	}
}
