Removed OverlayProxy and incorporated logic into Proxy.

This commit is contained in:
Sander Schobers 2020-05-17 20:07:52 +02:00
parent bcf3093c87
commit 0f54224cc7
2 changed files with 15 additions and 19 deletions

View File

@ -1,19 +0,0 @@
package ui
type OverlayProxy struct {
Proxy
}
func (p *OverlayProxy) Shown() {
overlay, ok := p.Content.(Overlay)
if ok {
overlay.Shown()
}
}
func (p *OverlayProxy) Hidden() {
overlay, ok := p.Content.(Overlay)
if ok {
overlay.Hidden()
}
}

View File

@ -3,6 +3,7 @@ package ui
import "opslag.de/schobers/geom" import "opslag.de/schobers/geom"
var _ Control = &Proxy{} var _ Control = &Proxy{}
var _ Overlay = &Proxy{}
type Proxy struct { type Proxy struct {
Content Control Content Control
@ -32,6 +33,13 @@ func (p *Proxy) Disable() { p.Content.Disable() }
func (p *Proxy) Enable() { p.Content.Enable() } func (p *Proxy) Enable() { p.Content.Enable() }
func (p *Proxy) Hidden() {
overlay, ok := p.Content.(Overlay)
if ok {
overlay.Hidden()
}
}
func (p *Proxy) IsDisabled() bool { return p.Content.IsDisabled() } func (p *Proxy) IsDisabled() bool { return p.Content.IsDisabled() }
func (p *Proxy) IsInBounds(pt geom.PointF32) bool { return p.Content.IsInBounds(pt) } func (p *Proxy) IsInBounds(pt geom.PointF32) bool { return p.Content.IsInBounds(pt) }
@ -41,3 +49,10 @@ func (p *Proxy) IsOver() bool { return p.Content.IsOver() }
func (p *Proxy) Offset() geom.PointF32 { return p.Content.Offset() } func (p *Proxy) Offset() geom.PointF32 { return p.Content.Offset() }
func (p *Proxy) Parent() Control { return p.Content.Parent() } func (p *Proxy) Parent() Control { return p.Content.Parent() }
func (p *Proxy) Shown() {
overlay, ok := p.Content.(Overlay)
if ok {
overlay.Shown()
}
}