gi-gtk-declarative-0.6.2: 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.

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.Widget

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 Pane Source # 
Instance details

Defined in GI.Gtk.Declarative.Container.Paned

Methods

subscribe :: Pane 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 #

IsBin parent => EventSource (Bin parent) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

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

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 #

(Typeable internalState, GObject widget) => EventSource (CustomWidget widget params internalState) Source # 
Instance details

Defined in GI.Gtk.Declarative.CustomWidget

Methods

subscribe :: CustomWidget widget params internalState 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.