gi-gtk-declarative-0.2.0: Declarative GTK+ programming in Haskell

Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Declarative.EventSource

Description

Event handling for declarative widgets.

Synopsis

Documentation

class EventSource widget where Source #

An EventSource can be subscribed to, with a callback, returning a Subscription.

Minimal complete definition

subscribe

Methods

subscribe Source #

Arguments

:: widget event

Declarative widget with event handlers.

-> SomeState

State of rendered widget tree.

-> (event -> IO ())

Event callback, invoked on each emitted event until the Subscription is cancelled, or widget is otherwise destroyed.

-> IO Subscription

A Subscription is returned, which can be cancelled.

Instances
EventSource Widget Source # 
Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

subscribe :: Widget event -> SomeState -> (event -> IO ()) -> IO Subscription Source #

EventSource BoxChild Source # 
Instance details

Defined in GI.Gtk.Declarative.Container.Box

Methods

subscribe :: BoxChild event -> SomeState -> (event -> IO ()) -> IO Subscription Source #

EventSource MenuItem Source # 
Instance details

Defined in GI.Gtk.Declarative.Container.MenuItem

Methods

subscribe :: MenuItem event -> SomeState -> (event -> IO ()) -> IO Subscription Source #

EventSource (SingleWidget widget) Source # 
Instance details

Defined in GI.Gtk.Declarative.SingleWidget

Methods

subscribe :: SingleWidget widget event -> SomeState -> (event -> IO ()) -> IO Subscription Source #

(BinChild parent child, EventSource child) => EventSource (Bin parent child) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

subscribe :: Bin parent child event -> SomeState -> (event -> IO ()) -> IO Subscription Source #

(Typeable child, EventSource child) => EventSource (Container widget (Children child)) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container

Methods

subscribe :: Container widget (Children child) event -> SomeState -> (event -> IO ()) -> IO Subscription Source #

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 Subscriptions are combined using the Semigroup instance.

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.