gi-gtk-declarative-0.1.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 callbacks.

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) => 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, callback ~ HaskellCallbackType info, Functor (PureCallback callback), ToGtkCallback (PureCallback callback), callback ~ CustomGtkCallback (PureCallback callback)) => SignalProxy widget info -> PureCallback callback event -> Attribute widget event

Emit events using a pure callback. Use the 'on function instead of this constructor directly.

OnSignalImpure :: (GObject widget, SignalInfo info, callback ~ HaskellCallbackType info, Functor (ImpureCallback callback widget), ToGtkCallback (ImpureCallback callback widget), (widget -> callback) ~ CustomGtkCallback (ImpureCallback callback widget)) => SignalProxy widget info -> ImpureCallback callback widget event -> Attribute widget event

Emit events using an impure callback. Use the 'on function instead of this constructor directly.

Instances
Functor (Attribute widget) Source #

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

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.

Event Handling

on :: (GObject widget, SignalInfo info, callback ~ HaskellCallbackType info, pure ~ ToPureCallback callback event, Functor (PureCallback callback), ToGtkCallback (PureCallback callback), callback ~ CustomGtkCallback (PureCallback callback)) => SignalProxy widget info -> pure -> Attribute widget event Source #

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

onM :: (GObject widget, SignalInfo info, callback ~ HaskellCallbackType info, impure ~ ToImpureCallback callback event, withWidget ~ (widget -> impure), Functor (ImpureCallback callback widget), ToGtkCallback (ImpureCallback callback widget), (widget -> callback) ~ CustomGtkCallback (ImpureCallback callback widget)) => SignalProxy widget info -> withWidget -> Attribute widget event Source #

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

Callbacks

class ToGtkCallback userCallback where Source #

Internal class for converting user callbacks to gi-gtk callbacks.

Minimal complete definition

toGtkCallback

Associated Types

type CustomGtkCallback userCallback :: * Source #

Methods

toGtkCallback :: userCallback event -> (event -> IO ()) -> CustomGtkCallback userCallback Source #

Converts a user callback, i.e. a pure or an impure callback, back to a GTK+ callback.