mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 00:16:15 +00:00
widget,widget/material: remove disabled drawing modes
Determining the enabled state of a widget from whether its Clicked method has been called only works for button-like widgets. For example, it's not clear a Clicked method is appropriate for a CheckBox. Remove the feature for now, and let's find a better design in the future. As a nice side effect, we can now process events in Layout methods, so that buttons react to user input even when Clicked is not called. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -78,10 +78,6 @@ func (t *Theme) IconButton(icon *Icon) IconButton {
|
||||
func (b Button) Layout(gtx *layout.Context, button *widget.Button) {
|
||||
col := b.Color
|
||||
bgcol := b.Background
|
||||
if !button.Active() {
|
||||
col = rgb(0x888888)
|
||||
bgcol = rgb(0xcccccc)
|
||||
}
|
||||
st := layout.Stack{Alignment: layout.Center}
|
||||
hmin := gtx.Constraints.Width.Min
|
||||
vmin := gtx.Constraints.Height.Min
|
||||
@@ -128,9 +124,6 @@ func (b IconButton) Layout(gtx *layout.Context, button *widget.Button) {
|
||||
button.Layout(gtx)
|
||||
})
|
||||
bgcol := b.Background
|
||||
if !button.Active() {
|
||||
bgcol = rgb(0xcccccc)
|
||||
}
|
||||
bg := st.Expand(gtx, func() {
|
||||
size := float32(gtx.Constraints.Width.Min)
|
||||
rr := float32(size) * .5
|
||||
|
||||
Reference in New Issue
Block a user