widget: [API] add child widget argument to Clickable.Layout

To make the semantic relation between the clickable area and its
content clear, it will be important for the clickable clip operation
to cover all of the clickable content.

API change: users of widget.Clickable must now pass the clickable
content to Layout.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-11-29 16:28:19 +01:00
parent a894bd6c9c
commit 665e23693f
6 changed files with 98 additions and 91 deletions
+2 -2
View File
@@ -36,8 +36,8 @@ func (b *Bool) History() []Press {
return b.clk.History()
}
func (b *Bool) Layout(gtx layout.Context) layout.Dimensions {
dims := b.clk.Layout(gtx)
func (b *Bool) Layout(gtx layout.Context, w layout.Widget) layout.Dimensions {
dims := b.clk.Layout(gtx, w)
for b.clk.Clicked() {
b.Value = !b.Value
b.changed = true