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

Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Declarative.Attributes

Contents

Description

Attribute lists on declarative objects, supporting the underlying attributes from Data.GI.Base.Attributes, along with CSS class lists, and pure and impure event EventHandlers.

Synopsis

Documentation

data Attribute widget event where Source #

The attribute GADT represent a supported attribute for a declarative widget. This extends the regular notion of GTK+ attributes to also include event handling and CSS classes.

Constructors

(:=) :: (AttrOpAllowed AttrConstruct info widget, AttrOpAllowed AttrSet info widget, AttrGetC info widget attr getValue, AttrSetTypeConstraint info setValue, KnownSymbol attr, Typeable attr, Eq setValue, Typeable setValue) => AttrLabelProxy (attr :: Symbol) -> setValue -> Attribute widget event

An attribute/value mapping for a declarative widget. The AttrLabelProxy is parameterized by attr, which represents the GTK-defined attribute name. The underlying GI object needs to support the construct, get, and set operations for the given attribute.

Classes :: IsWidget widget => ClassSet -> Attribute widget event

Defines a set of CSS classes for the underlying widget's style context. Use the classes function instead of this constructor directly.

OnSignalPure :: (GObject widget, SignalInfo info, gtkCallback ~ HaskellCallbackType info, ToGtkCallback gtkCallback Pure) => SignalProxy widget info -> EventHandler gtkCallback widget Pure event -> Attribute widget event

Emit events using a pure event handler. Use the on function, instead of this constructor directly.

OnSignalImpure :: (GObject widget, SignalInfo info, gtkCallback ~ HaskellCallbackType info, ToGtkCallback gtkCallback Impure) => SignalProxy widget info -> EventHandler gtkCallback widget Impure event -> Attribute widget event

Emit events using a pure event handler. Use the on function, instead of this constructor directly.

AfterCreated :: (widget -> IO ()) -> Attribute widget event

Provide a callback to modify the widget after it's been created.

Instances
Functor (Attribute widget) Source #

Attributes have a Functor instance that maps events in all event handler.

Instance details

Defined in GI.Gtk.Declarative.Attributes

Methods

fmap :: (a -> b) -> Attribute widget a -> Attribute widget b #

(<$) :: a -> Attribute widget b -> Attribute widget a #

classes :: IsWidget widget => [Text] -> Attribute widget event Source #

Define the CSS classes for the underlying widget's style context. For these classes to have any effect, this requires a CssProvider with CSS files loaded, to be added to the GDK screen. You probably want to do this in your entry point when setting up GTK.

afterCreated :: (widget -> IO ()) -> Attribute widget event Source #

Provide a EventHandler to modify the widget after it's been created.

type ClassSet = HashSet Text Source #

A set of CSS classes.

Event Handling

on :: (GObject widget, SignalInfo info, gtkCallback ~ HaskellCallbackType info, ToGtkCallback gtkCallback Pure, ToEventHandler gtkCallback widget Pure, userEventHandler ~ UserEventHandler gtkCallback widget Pure event) => SignalProxy widget info -> userEventHandler -> Attribute widget event Source #

Emit events, using a pure event handler, by subcribing to the specified signal.

onM :: (GObject widget, SignalInfo info, gtkCallback ~ HaskellCallbackType info, ToGtkCallback gtkCallback Impure, ToEventHandler gtkCallback widget Impure, userEventHandler ~ UserEventHandler gtkCallback widget Impure event) => SignalProxy widget info -> userEventHandler -> Attribute widget event Source #

Emit events, using an impure event handler receiving the widget and returning an IO action of event, by subcribing to the specified signal.

EventHandlers

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 #