zntg/ui/proxy.go
Sander Schobers dbc017507c Added Parent to Controls.
Fixed issue where events of partially and invisible controls where incorrectly handled.
2019-04-11 23:38:32 +02:00

54 lines
1.1 KiB
Go

package ui
import "opslag.de/schobers/geom"
var _ Control = &Proxy{}
type Proxy struct {
Content Control
}
func (p *Proxy) Arrange(ctx Context, bounds geom.RectangleF32, offset geom.PointF32, parent Control) {
p.Content.Arrange(ctx, bounds, offset, parent)
}
func (p *Proxy) DesiredSize(ctx Context) geom.PointF32 {
return p.Content.DesiredSize(ctx)
}
func (p *Proxy) Handle(ctx Context, e Event) {
p.Content.Handle(ctx, e)
}
func (p *Proxy) Render(ctx Context) {
p.Content.Render(ctx)
}
func (p *Proxy) Bounds() geom.RectangleF32 {
return p.Content.Bounds()
}
func (p *Proxy) IsInBounds(pt geom.PointF32) bool { return p.Content.IsInBounds(pt) }
func (p *Proxy) IsOver() bool { return p.Content.IsOver() }
func (p *Proxy) Offset() geom.PointF32 { return p.Content.Offset() }
func (p *Proxy) OnClick(fn ClickFn) {
p.Content.OnClick(fn)
}
func (p *Proxy) OnDragStart(fn DragStartFn) {
p.Content.OnDragStart(fn)
}
func (p *Proxy) OnDragMove(fn DragMoveFn) {
p.Content.OnDragMove(fn)
}
func (p *Proxy) OnDragEnd(fn DragEndFn) {
p.Content.OnDragEnd(fn)
}
func (p *Proxy) Parent() Control { return p.Content.Parent() }