mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget/material: add support for disabled buttons
This leverages the new semantics of a disabled layout.Context to draw all of the button types in a disabled state. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -129,7 +129,11 @@ func (b ButtonLayoutStyle) Layout(gtx layout.Context, w layout.Widget) layout.Di
|
||||
}},
|
||||
NE: rr, NW: rr, SE: rr, SW: rr,
|
||||
}.Op(gtx.Ops).Add(gtx.Ops)
|
||||
dims := fill(gtx, b.Background)
|
||||
background := b.Background
|
||||
if gtx.Queue == nil {
|
||||
background = mulAlpha(b.Background, 150)
|
||||
}
|
||||
dims := fill(gtx, background)
|
||||
for _, c := range b.Button.History() {
|
||||
drawInk(gtx, c)
|
||||
}
|
||||
@@ -155,7 +159,11 @@ func (b IconButtonStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
Rect: f32.Rectangle{Max: f32.Point{X: sizef, Y: sizef}},
|
||||
NE: rr, NW: rr, SE: rr, SW: rr,
|
||||
}.Op(gtx.Ops).Add(gtx.Ops)
|
||||
dims := fill(gtx, b.Background)
|
||||
background := b.Background
|
||||
if gtx.Queue == nil {
|
||||
background = mulAlpha(b.Background, 150)
|
||||
}
|
||||
dims := fill(gtx, background)
|
||||
for _, c := range b.Button.History() {
|
||||
drawInk(gtx, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user