Add light gray background to StatusBar and BottomBar
Rename shaper_usage.md to layout_rendering.md
This commit is contained in:
parent
b8c6878f46
commit
4893d69f4e
|
|
@ -110,6 +110,18 @@ func (r *Renderer) drawStatusBar(gtx layout.Context, sb StatusBar, _ WindowConst
|
||||||
th := material.NewTheme()
|
th := material.NewTheme()
|
||||||
th.Shaper = r.shp
|
th.Shaper = r.shp
|
||||||
|
|
||||||
|
// Draw light gray background
|
||||||
|
bgColor := color.NRGBA{R: 230, G: 230, B: 230, A: 255}
|
||||||
|
m := op.Record(gtx.Ops)
|
||||||
|
clip.Rect{
|
||||||
|
Min: image.Point{X: int(r.toPx(reg.X)), Y: int(r.toPx(reg.Y))},
|
||||||
|
Max: image.Point{X: int(r.toPx(reg.X + reg.W)), Y: int(r.toPx(reg.Y + reg.H))},
|
||||||
|
}.Op().Push(gtx.Ops)
|
||||||
|
paint.ColorOp{Color: bgColor}.Add(gtx.Ops)
|
||||||
|
paint.PaintOp{}.Add(gtx.Ops)
|
||||||
|
call := m.Stop()
|
||||||
|
call.Add(gtx.Ops)
|
||||||
|
|
||||||
// Clip to status bar region (convert Dp to pixels)
|
// Clip to status bar region (convert Dp to pixels)
|
||||||
c := clip.Rect{
|
c := clip.Rect{
|
||||||
Min: image.Point{X: int(r.toPx(reg.X)), Y: int(r.toPx(reg.Y))},
|
Min: image.Point{X: int(r.toPx(reg.X)), Y: int(r.toPx(reg.Y))},
|
||||||
|
|
@ -173,6 +185,18 @@ func (r *Renderer) drawStatusBar(gtx layout.Context, sb StatusBar, _ WindowConst
|
||||||
func (r *Renderer) drawBottomBar(gtx layout.Context, bb BottomBar, constraints WindowConstraints) {
|
func (r *Renderer) drawBottomBar(gtx layout.Context, bb BottomBar, constraints WindowConstraints) {
|
||||||
reg := bb.Region()
|
reg := bb.Region()
|
||||||
|
|
||||||
|
// Draw light gray background
|
||||||
|
bgColor := color.NRGBA{R: 230, G: 230, B: 230, A: 255}
|
||||||
|
m := op.Record(gtx.Ops)
|
||||||
|
clip.Rect{
|
||||||
|
Min: image.Point{X: int(r.toPx(reg.X)), Y: int(r.toPx(reg.Y))},
|
||||||
|
Max: image.Point{X: int(r.toPx(reg.X + reg.W)), Y: int(r.toPx(reg.Y + reg.H))},
|
||||||
|
}.Op().Push(gtx.Ops)
|
||||||
|
paint.ColorOp{Color: bgColor}.Add(gtx.Ops)
|
||||||
|
paint.PaintOp{}.Add(gtx.Ops)
|
||||||
|
call := m.Stop()
|
||||||
|
call.Add(gtx.Ops)
|
||||||
|
|
||||||
// Use captured constraints for positioning — they are in pixels and
|
// Use captured constraints for positioning — they are in pixels and
|
||||||
// represent the actual window bounds. Never use gtx.Constraints here
|
// represent the actual window bounds. Never use gtx.Constraints here
|
||||||
// because clips modify them.
|
// because clips modify them.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user