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

Safe HaskellSafe
LanguageHaskell2010

GI.Gtk.Declarative.Attributes.Internal.EventHandler

Synopsis

Documentation

data Purity Source #

A EventHandler can be either pure or impure.

Constructors

Pure 
Impure 

data EventHandlerReturn m gtkReturn event where Source #

The two supported types of return values in user event handlers are encoded by the EventHandlerReturn type; either you can return only an event, or if the underlying GTK+ callback needs to return a Bool, you return a (Bool, event) tuple.

Constructors

OnlyEvent :: m e -> EventHandlerReturn m () e 
ReturnAndEvent :: m (Bool, e) -> EventHandlerReturn m Bool e 
Instances
Functor m => Functor (EventHandlerReturn m gtkEventHandler) Source # 
Instance details

Defined in GI.Gtk.Declarative.Attributes.Internal.EventHandler

Methods

fmap :: (a -> b) -> EventHandlerReturn m gtkEventHandler a -> EventHandlerReturn m gtkEventHandler b #

(<$) :: a -> EventHandlerReturn m gtkEventHandler b -> EventHandlerReturn m gtkEventHandler a #

data EventHandler gtkEventHandler widget (purity :: Purity) event where Source #

Encodes the user event handler in such a way that we can have a Functor instance for arity-polymorphic event handlers.

Constructors

PureEventHandler :: EventHandlerReturn Identity ret e -> EventHandler (IO ret) w Pure e 
ImpureEventHandler :: (w -> EventHandlerReturn IO ret e) -> EventHandler (IO ret) w Impure e 
EventHandlerFunction :: (a -> EventHandler b w p e) -> EventHandler (a -> b) w p e 
Instances
Functor (EventHandler gtkEventHandler widget purity) Source # 
Instance details

Defined in GI.Gtk.Declarative.Attributes.Internal.EventHandler

Methods

fmap :: (a -> b) -> EventHandler gtkEventHandler widget purity a -> EventHandler gtkEventHandler widget purity b #

(<$) :: a -> EventHandler gtkEventHandler widget purity b -> EventHandler gtkEventHandler widget purity a #

type family UserEventHandler gtkCallback widget (purity :: Purity) event where ... Source #

Convert from a GTK+ callback type to a user event handler type (the ones you'd apply on and onM with) based on the given widget, purity, and event types.

Equations

UserEventHandler (IO ()) widget Pure event = event 
UserEventHandler (IO Bool) widget Pure event = (Bool, event) 
UserEventHandler (IO ()) widget Impure event = widget -> IO event 
UserEventHandler (IO Bool) widget Impure event = widget -> IO (Bool, event) 
UserEventHandler (a -> b) widget purity event = a -> UserEventHandler b widget purity event 

class ToEventHandler gtkEventHandler widget purity where Source #

Internal class for converting user event handlers to encoded EventHandler values.

Methods

toEventHandler :: UserEventHandler gtkEventHandler widget purity event -> EventHandler gtkEventHandler widget purity event Source #

Convert from a user event handler to an EventHandler.

Instances
ToEventHandler (IO Bool) widget Impure Source # 
Instance details

Defined in GI.Gtk.Declarative.Attributes.Internal.EventHandler

Methods

toEventHandler :: UserEventHandler (IO Bool) widget Impure event -> EventHandler (IO Bool) widget Impure event Source #

ToEventHandler (IO Bool) widget Pure Source # 
Instance details

Defined in GI.Gtk.Declarative.Attributes.Internal.EventHandler

Methods

toEventHandler :: UserEventHandler (IO Bool) widget Pure event -> EventHandler (IO Bool) widget Pure event Source #

ToEventHandler (IO ()) widget Impure Source # 
Instance details

Defined in GI.Gtk.Declarative.Attributes.Internal.EventHandler

Methods

toEventHandler :: UserEventHandler (IO ()) widget Impure event -> EventHandler (IO ()) widget Impure event Source #

ToEventHandler (IO ()) widget Pure Source # 
Instance details

Defined in GI.Gtk.Declarative.Attributes.Internal.EventHandler

Methods

toEventHandler :: UserEventHandler (IO ()) widget Pure event -> EventHandler (IO ()) widget Pure event Source #

ToEventHandler b widget purity => ToEventHandler (a -> b) widget purity Source # 
Instance details

Defined in GI.Gtk.Declarative.Attributes.Internal.EventHandler

Methods

toEventHandler :: UserEventHandler (a -> b) widget purity event -> EventHandler (a -> b) widget purity event Source #