mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
@@ -28,11 +28,12 @@ func ExampleClickable_passthrough() {
|
||||
|
||||
// widget lays out two buttons on top of each other.
|
||||
widget := func() {
|
||||
button1.Layout(gtx)
|
||||
content := func(gtx layout.Context) layout.Dimensions { return layout.Dimensions{Size: gtx.Constraints.Min} }
|
||||
button1.Layout(gtx, content)
|
||||
// button2 completely covers button1, but pass-through allows pointer
|
||||
// events to pass through to button1.
|
||||
defer pointer.PassOp{}.Push(gtx.Ops).Pop()
|
||||
button2.Layout(gtx)
|
||||
button2.Layout(gtx, content)
|
||||
}
|
||||
|
||||
// The first layout and call to Frame declare the Clickable handlers
|
||||
|
||||
Reference in New Issue
Block a user