github.com/utopiagio/gio@v0.0.8/io/event/event.go (about) 1 // SPDX-License-Identifier: Unlicense OR MIT 2 3 // Package event contains types for event handling. 4 package event 5 6 import ( 7 "github.com/utopiagio/gio/internal/ops" 8 "github.com/utopiagio/gio/op" 9 ) 10 11 // Tag is the stable identifier for an event handler. 12 // For a handler h, the tag is typically &h. 13 type Tag interface{} 14 15 // Event is the marker interface for events. 16 type Event interface { 17 ImplementsEvent() 18 } 19 20 // Filter represents a filter for [Event] types. 21 type Filter interface { 22 ImplementsFilter() 23 } 24 25 // Op declares a tag for input routing at the current transformation 26 // and clip area hierarchy. It panics if tag is nil. 27 func Op(o *op.Ops, tag Tag) { 28 if tag == nil { 29 panic("Tag must be non-nil") 30 } 31 data := ops.Write1(&o.Internal, ops.TypeInputLen, tag) 32 data[0] = byte(ops.TypeInput) 33 }