Moved Shadow and added Background control.
This commit is contained in:
parent
6bcab622ae
commit
8d78083583
@ -1,9 +1,27 @@
|
||||
package ui
|
||||
|
||||
import "opslag.de/schobers/geom"
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
type shadow struct {
|
||||
"opslag.de/schobers/geom"
|
||||
)
|
||||
|
||||
func Background(content Control, c color.Color) Control {
|
||||
return &background{Proxy: Proxy{Content: content}, Background: c}
|
||||
}
|
||||
|
||||
type background struct {
|
||||
Proxy
|
||||
|
||||
Background color.Color
|
||||
}
|
||||
|
||||
func (b *background) Render(ctx Context) {
|
||||
bounds := b.Proxy.Bounds()
|
||||
if b.Background != nil {
|
||||
ctx.Renderer().FillRectangle(bounds, b.Background)
|
||||
}
|
||||
b.Proxy.Render(ctx)
|
||||
}
|
||||
|
||||
func Shadow(content Control) *shadow {
|
||||
@ -12,6 +30,10 @@ func Shadow(content Control) *shadow {
|
||||
return s
|
||||
}
|
||||
|
||||
type shadow struct {
|
||||
Proxy
|
||||
}
|
||||
|
||||
func (s *shadow) Render(ctx Context) {
|
||||
s.Proxy.Render(ctx)
|
||||
b := s.Bounds()
|
Loading…
Reference in New Issue
Block a user