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
EventSource Widget Source # | |
Defined in GI.Gtk.Declarative.Widget | |
EventSource BoxChild Source # | |
Defined in GI.Gtk.Declarative.Container.Box | |
EventSource Pane Source # | |
Defined in GI.Gtk.Declarative.Container.Paned | |
EventSource MenuItem Source # | |
Defined in GI.Gtk.Declarative.Container.MenuItem | |
EventSource (SingleWidget widget) Source # | |
Defined in GI.Gtk.Declarative.SingleWidget subscribe :: SingleWidget widget event -> SomeState -> (event -> IO ()) -> IO Subscription Source # | |
IsBin parent => EventSource (Bin parent) Source # | |
Defined in GI.Gtk.Declarative.Bin | |
GObject widget => EventSource (CustomWidget widget customData) Source # | |
Defined in GI.Gtk.Declarative.CustomWidget subscribe :: CustomWidget widget customData event -> SomeState -> (event -> IO ()) -> IO Subscription Source # | |
(Typeable child, EventSource child) => EventSource (Container widget (Children child)) Source # | |
Defined in GI.Gtk.Declarative.Container |
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.