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

Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Declarative.Markup

Contents

Description

MarkupOf is the common builder type for the (declarative) GTK+ markup language, supporting do syntax. MarkupOf wraps many widgets, usually of type Widget, but they can be of other types.

A Widget value can wrap any Patchable widget, hiding the underlying widget type, such that you can embed heterogeneous collections of widgets in containers.

Synopsis

Documentation

data Widget event where Source #

A Widget value wraps a Patchable and EventSource widget, providing a constrained equivalent of a Dynamic value. It is used to support heterogeneous containers of widgets, and to support equality checks on different types of widgets when calculating patches.

Constructors

Widget :: (Typeable widget, Patchable widget, Functor widget, EventSource widget) => widget event -> Widget event 
Instances
Functor Widget Source # 
Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

fmap :: (a -> b) -> Widget a -> Widget b #

(<$) :: a -> Widget b -> Widget a #

EventSource Widget Source # 
Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

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

Patchable Widget Source #

Widget is itself patchable, by delegating to the underlying widget instances.

Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

create :: Widget e -> IO Widget0 Source #

patch :: Widget e1 -> Widget e2 -> Patch Source #

FromWidget Widget event (Widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

fromWidget :: Widget event -> Widget event Source #

IsContainer ListBox (Bin ListBoxRow Widget) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container.Patch

Methods

appendChild :: ListBox -> Bin ListBoxRow Widget event -> Widget0 -> IO () Source #

replaceChild :: ListBox -> Bin ListBoxRow Widget event -> Int32 -> Widget0 -> Widget0 -> IO () Source #

(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.SingleWidget

Methods

fromWidget :: SingleWidget widget event -> Widget event Source #

(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Markup event ()) Source # 
Instance details

Defined in GI.Gtk.Declarative.SingleWidget

Methods

fromWidget :: SingleWidget widget event -> Markup event () Source #

(BinChild widget child, Typeable widget, Patchable child, EventSource child, Functor (Bin widget child)) => FromWidget (Bin widget child) event (Widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

fromWidget :: Bin widget child event -> Widget event Source #

(Typeable widget, Typeable children, Patchable (Container widget children), EventSource (Container widget children), Functor (Container widget children)) => FromWidget (Container widget children) event (Widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container

Methods

fromWidget :: Container widget children event -> Widget event Source #

(BinChild widget child, a ~ (), Typeable widget, Patchable child, EventSource child, Functor (Bin widget child)) => FromWidget (Bin widget child) event (Markup event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

fromWidget :: Bin widget child event -> Markup event a Source #

(a ~ (), Typeable widget, Typeable children, Patchable (Container widget children), EventSource (Container widget children), Functor (Container widget children)) => FromWidget (Container widget children) event (Markup event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container

Methods

fromWidget :: Container widget children event -> Markup event a Source #

Markup

data MarkupOf widget event a Source #

The declarative markup builder, primarily for using its Monad instance and do notation to construct adjacent widgets in containers.

It is parameterized with widget and event, such that containers can restrict the type of their children to other types than Widget.

Note that the return type, a, is not used in this library. It's a more a technical necessity to have the Monad instance. You can still use it if you need to return a value from a markup function, though.

Instances
(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Markup event ()) Source # 
Instance details

Defined in GI.Gtk.Declarative.SingleWidget

Methods

fromWidget :: SingleWidget widget event -> Markup event () Source #

FromWidget (SingleWidget widget) event (MarkupOf (SingleWidget widget) event ()) Source # 
Instance details

Defined in GI.Gtk.Declarative.SingleWidget

Methods

fromWidget :: SingleWidget widget event -> MarkupOf (SingleWidget widget) event () Source #

Monad (MarkupOf widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

(>>=) :: MarkupOf widget event a -> (a -> MarkupOf widget event b) -> MarkupOf widget event b #

(>>) :: MarkupOf widget event a -> MarkupOf widget event b -> MarkupOf widget event b #

return :: a -> MarkupOf widget event a #

fail :: String -> MarkupOf widget event a #

Functor (MarkupOf widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

fmap :: (a -> b) -> MarkupOf widget event a -> MarkupOf widget event b #

(<$) :: a -> MarkupOf widget event b -> MarkupOf widget event a #

Applicative (MarkupOf widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

pure :: a -> MarkupOf widget event a #

(<*>) :: MarkupOf widget event (a -> b) -> MarkupOf widget event a -> MarkupOf widget event b #

liftA2 :: (a -> b -> c) -> MarkupOf widget event a -> MarkupOf widget event b -> MarkupOf widget event c #

(*>) :: MarkupOf widget event a -> MarkupOf widget event b -> MarkupOf widget event b #

(<*) :: MarkupOf widget event a -> MarkupOf widget event b -> MarkupOf widget event a #

(BinChild widget child, a ~ (), Typeable widget, Patchable child, EventSource child, Functor (Bin widget child)) => FromWidget (Bin widget child) event (Markup event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

fromWidget :: Bin widget child event -> Markup event a Source #

(a ~ (), Typeable widget, Typeable children, Patchable (Container widget children), EventSource (Container widget children), Functor (Container widget children)) => FromWidget (Container widget children) event (Markup event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container

Methods

fromWidget :: Container widget children event -> Markup event a Source #

a ~ () => FromWidget (Bin widget child) event (MarkupOf (Bin widget child) event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

fromWidget :: Bin widget child event -> MarkupOf (Bin widget child) event a Source #

a ~ () => FromWidget (Container widget children) event (MarkupOf (Container widget children) event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container

Methods

fromWidget :: Container widget children event -> MarkupOf (Container widget children) event a Source #

type Markup event a = MarkupOf Widget event a Source #

Handy type alias for the common case of markup containing Widgets.

single :: widget event -> MarkupOf widget event () Source #

Construct markup from a single widget.

multiple :: [widget event] -> MarkupOf widget event () Source #

Construct markup from multiple widgets.

runMarkup :: MarkupOf widget event () -> [widget event] Source #

Run a MarkupOf builder and get its widgets.

Widget to Markup conversion

class FromWidget widget event target | target -> event where Source #

Convert a widget to a target type. This is deliberately unconstrained in it's types, and is used by smart constructors to implement return type polymorphism, so that a smart contructor can return either a Widget, or some specifically typed MarkupOf, depending on the context in which it's used.

Minimal complete definition

fromWidget

Methods

fromWidget :: (Typeable widget, Typeable event) => widget event -> target Source #

Instances
FromWidget Widget event (Widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Markup

Methods

fromWidget :: Widget event -> Widget event Source #

(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.SingleWidget

Methods

fromWidget :: SingleWidget widget event -> Widget event Source #

(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Markup event ()) Source # 
Instance details

Defined in GI.Gtk.Declarative.SingleWidget

Methods

fromWidget :: SingleWidget widget event -> Markup event () Source #

FromWidget (SingleWidget widget) event (MarkupOf (SingleWidget widget) event ()) Source # 
Instance details

Defined in GI.Gtk.Declarative.SingleWidget

Methods

fromWidget :: SingleWidget widget event -> MarkupOf (SingleWidget widget) event () Source #

(BinChild widget child, Typeable widget, Patchable child, EventSource child, Functor (Bin widget child)) => FromWidget (Bin widget child) event (Widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

fromWidget :: Bin widget child event -> Widget event Source #

(Typeable widget, Typeable children, Patchable (Container widget children), EventSource (Container widget children), Functor (Container widget children)) => FromWidget (Container widget children) event (Widget event) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container

Methods

fromWidget :: Container widget children event -> Widget event Source #

(BinChild widget child, a ~ (), Typeable widget, Patchable child, EventSource child, Functor (Bin widget child)) => FromWidget (Bin widget child) event (Markup event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

fromWidget :: Bin widget child event -> Markup event a Source #

(a ~ (), Typeable widget, Typeable children, Patchable (Container widget children), EventSource (Container widget children), Functor (Container widget children)) => FromWidget (Container widget children) event (Markup event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container

Methods

fromWidget :: Container widget children event -> Markup event a Source #

a ~ () => FromWidget (Bin widget child) event (MarkupOf (Bin widget child) event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Bin

Methods

fromWidget :: Bin widget child event -> MarkupOf (Bin widget child) event a Source #

a ~ () => FromWidget (Container widget children) event (MarkupOf (Container widget children) event a) Source # 
Instance details

Defined in GI.Gtk.Declarative.Container

Methods

fromWidget :: Container widget children event -> MarkupOf (Container widget children) event a Source #