Safe Haskell | None |
---|---|
Language | Haskell2010 |
Event handling for declarative widgets.
Synopsis
- class EventSource widget where
- subscribe :: widget event -> SomeState -> (event -> IO ()) -> IO Subscription
- data Subscription
- fromCancellation :: IO () -> Subscription
- cancel :: Subscription -> IO ()
Documentation
class EventSource widget where Source #
An EventSource
can be subscribed to, with a callback, returning a
Subscription
.
:: widget event | Declarative widget with event handlers. |
-> SomeState | State of rendered widget tree. |
-> (event -> IO ()) | Event callback, invoked on each emitted event until
the |
-> IO Subscription | A |
Instances
data Subscription Source #
A Subscription
contains zero or more cancellation actions for connected
handlers (to a tree of widgets.) When subscribing to a container widget, all
child widgets are also subscribed to, and the Subscription
s are combined
using the Semigroup
instance.
Instances
Semigroup Subscription Source # | |
Defined in GI.Gtk.Declarative.EventSource (<>) :: Subscription -> Subscription -> Subscription # sconcat :: NonEmpty Subscription -> Subscription # stimes :: Integral b => b -> Subscription -> Subscription # | |
Monoid Subscription Source # | |
Defined in GI.Gtk.Declarative.EventSource mempty :: Subscription # mappend :: Subscription -> Subscription -> Subscription # mconcat :: [Subscription] -> Subscription # |
fromCancellation :: IO () -> Subscription Source #
Create a subscription from a cancellation IO action.
cancel :: Subscription -> IO () Source #
Cancel a Subscription
, meaning that the callback will not be invoked on
any subsequent signal emissions.