allg5/alui/overlay.go

40 lines
629 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"
)
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
}
2020-04-10 09:00:27 +00:00
func (o *Overlay) Handle(ctx *Context, e allg5.Event) {
2020-03-08 09:10:41 +00:00
if o.Visible {
2020-04-10 09:00:27 +00:00
o.Proxy.Handle(ctx, e)
2020-03-08 09:10:41 +00:00
}
}
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)
}
}