zntg/ui/wrapper.go

59 lines
1.0 KiB
Go
Raw Normal View History

package ui
import (
"time"
"opslag.de/schobers/galleg/allegro5"
"opslag.de/schobers/geom"
)
type Wrapper struct {
Wrapped Control
Bounds geom.RectangleF
}
func Wrap(c Control) Wrapper {
return Wrapper{Wrapped: c}
}
func (w *Wrapper) Created(ctx Context, p Container) error {
return w.Wrapped.Created(ctx, p)
}
func (w *Wrapper) Destroyed(ctx Context) {
w.Wrapped.Destroyed(ctx)
}
func (w *Wrapper) Update(ctx Context, d time.Duration) {
w.Wrapped.Update(ctx, d)
}
func (w *Wrapper) Handle(ctx Context, ev allegro5.Event) {
w.Wrapped.Handle(ctx, ev)
}
func (w *Wrapper) DesiredSize(ctx Context) geom.PointF {
return w.Wrapped.DesiredSize(ctx)
}
func (w *Wrapper) Rect() geom.RectangleF {
return w.Bounds
}
func (w *Wrapper) SetRect(rect geom.RectangleF) {
w.Bounds = rect
}
func (w *Wrapper) Render(ctx Context) {
w.Wrapped.Render(ctx)
}
func (w *Wrapper) Children() []Control {
return []Control{w.Wrapped}
}
func (w *Wrapper) Arrange(ctx Context, rect geom.RectangleF) {
w.Bounds = rect
Arrange(ctx, w.Wrapped, rect)
}