2018-09-09 19:07:53 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
"opslag.de/schobers/zntg/allg5"
|
2018-09-09 19:07:53 +00:00
|
|
|
"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)
|
|
|
|
}
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func (w *Wrapper) Handle(ctx Context, ev allg5.Event) {
|
2018-09-09 19:07:53 +00:00
|
|
|
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)
|
|
|
|
}
|