45 lines
754 B
Go
45 lines
754 B
Go
|
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
|
||
|
}
|
||
|
|
||
|
func (p *Proxy) Handle(e allg5.Event) {
|
||
|
if p.Target != nil {
|
||
|
p.Target.Handle(e)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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)
|
||
|
}
|
||
|
}
|