Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- data Widget event where
- data MarkupOf widget event a
- type Markup event a = MarkupOf Widget event a
- single :: widget event -> MarkupOf widget event ()
- multiple :: [widget event] -> MarkupOf widget event ()
- runMarkup :: MarkupOf widget event () -> [widget event]
- class FromWidget widget event target | target -> event where
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.
Widget :: (Typeable widget, Patchable widget, Functor widget, EventSource widget) => widget event -> Widget event |
Instances
Functor Widget Source # | |
EventSource Widget Source # | |
Defined in GI.Gtk.Declarative.Markup | |
Patchable Widget Source # |
|
FromWidget Widget event (Widget event) Source # | |
Defined in GI.Gtk.Declarative.Markup fromWidget :: Widget event -> Widget event Source # | |
IsContainer ListBox (Bin ListBoxRow Widget) Source # | |
Defined in GI.Gtk.Declarative.Container.Patch | |
(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Widget event) Source # | |
Defined in GI.Gtk.Declarative.SingleWidget fromWidget :: SingleWidget widget event -> Widget event Source # | |
(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Markup event ()) Source # | |
Defined in GI.Gtk.Declarative.SingleWidget 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 # | |
Defined in GI.Gtk.Declarative.Bin 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 # | |
Defined in GI.Gtk.Declarative.Container 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 # | |
Defined in GI.Gtk.Declarative.Bin 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 # | |
Defined in GI.Gtk.Declarative.Container 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 # | |
Defined in GI.Gtk.Declarative.SingleWidget fromWidget :: SingleWidget widget event -> Markup event () Source # | |
FromWidget (SingleWidget widget) event (MarkupOf (SingleWidget widget) event ()) Source # | |
Defined in GI.Gtk.Declarative.SingleWidget fromWidget :: SingleWidget widget event -> MarkupOf (SingleWidget widget) event () Source # | |
Monad (MarkupOf widget event) Source # | |
Defined in GI.Gtk.Declarative.Markup | |
Functor (MarkupOf widget event) Source # | |
Applicative (MarkupOf widget event) Source # | |
Defined in GI.Gtk.Declarative.Markup 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 # | |
Defined in GI.Gtk.Declarative.Bin 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 # | |
Defined in GI.Gtk.Declarative.Container fromWidget :: Container widget children event -> Markup event a Source # | |
a ~ () => FromWidget (Bin widget child) event (MarkupOf (Bin widget child) event a) Source # | |
Defined in GI.Gtk.Declarative.Bin | |
a ~ () => FromWidget (Container widget children) event (MarkupOf (Container widget children) event a) Source # | |
Defined in GI.Gtk.Declarative.Container |
type Markup event a = MarkupOf Widget event a Source #
Handy type alias for the common case of markup containing Widget
s.
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.
fromWidget :: (Typeable widget, Typeable event) => widget event -> target Source #
Instances
FromWidget Widget event (Widget event) Source # | |
Defined in GI.Gtk.Declarative.Markup fromWidget :: Widget event -> Widget event Source # | |
(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Widget event) Source # | |
Defined in GI.Gtk.Declarative.SingleWidget fromWidget :: SingleWidget widget event -> Widget event Source # | |
(Typeable widget, Functor (SingleWidget widget)) => FromWidget (SingleWidget widget) event (Markup event ()) Source # | |
Defined in GI.Gtk.Declarative.SingleWidget fromWidget :: SingleWidget widget event -> Markup event () Source # | |
FromWidget (SingleWidget widget) event (MarkupOf (SingleWidget widget) event ()) Source # | |
Defined in GI.Gtk.Declarative.SingleWidget 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 # | |
Defined in GI.Gtk.Declarative.Bin 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 # | |
Defined in GI.Gtk.Declarative.Container 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 # | |
Defined in GI.Gtk.Declarative.Bin 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 # | |
Defined in GI.Gtk.Declarative.Container fromWidget :: Container widget children event -> Markup event a Source # | |
a ~ () => FromWidget (Bin widget child) event (MarkupOf (Bin widget child) event a) Source # | |
Defined in GI.Gtk.Declarative.Bin | |
a ~ () => FromWidget (Container widget children) event (MarkupOf (Container widget children) event a) Source # | |
Defined in GI.Gtk.Declarative.Container |